When you click on the segmentfault tag, the details of the TAG content will be displayed in the pop-up box. However, I found that the TAG content is repeatedly swiped multiple times on the console, and ajax only initiates the request for the first time, which of the following technologies is used to display the TAG content in the segmentfault label dialog box? However, I found that the ajax request was initiated only for the first time after repeated sliding on the console, what technologies are used here?
Reply content:
When you click on the segmentfault tag, the detailed TAG content is displayed in the pop-up box. However, I found that the TAG content is repeatedly swiped multiple times on the console. ajax only initiates the request for the first time. What technology is used?
After the first request, enter the content in the DOM and then cancel it.hover
The AJAX listening part of the event (or mark the content that has been filled with the attribute on the DOM.
I guess,
var api = {};$ajaxForm.on('submit',function(event) { event.preventDefault(); $response.empty(); var search = $('#title').val(); if (search == '') { return; } $response.addClass('loading'); if (!api[search]) { api[search] = $.ajax({ url: 'http://book.learningjquery.com/api/', dataType: 'jsonp', data: { title: search }, timeout: 15000 }); } api[search].done(response).fail(function() { $response.html(failed); }).always(function() { $response.removeClass('loading'); });});
(The Code comes from the basic jQuery tutorial.13.3.2 cache response)