ajax (.. 200 && , ? , success XHR: requestLog.sendStatus = true;, ajax, (requestLog.sendStatus = true;) e.preventDefault. ajax, requestLog.sendStatus = true success ajax.
var requestLog = {};
requestLog.sendStatus = false;
$(".button").click(function(e) {
e.preventDefault();
if(requestLog.sendStatus) return;
$.ajax({
type: 'post',
cache: false ,
url: 'my/ajaxrequest.php',
data: { result : 'hi test data' },
success: function(resp) {
$("#result").html(resp);
requestLog.sendStatus = true;
}
});
});
? :
(function() {
$.ajax({
type: 'post',
cache: false ,
url: 'my/ajaxrequest.php',
data: { result : 'hi test data' },
success: function(resp) {
$("#result").html(resp);
}
});
}());