此代码
$("#loading").ajaxStart(function() {
alert("start");
$(this).show();
});
在我的标记中
这是完整的ajax请求:
$.ajax({
type: "POST",
url: "http://localhost/WebServices/Service.asmx/GetResults",
data: jsonText,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(response) {
var results = (typeof response.d) == 'string' ? eval('(' + response.d + ')') : response.d;
PopulateTree(results);
},
error: function(xhr, status, error) {
var msg = JSON.parse(xhr.responseText);
alert(msg.Message);
}
});
$("#loading").ajaxStart(function() {
alert("start");
$(this).show();
});
$("#loading").ajaxStop(function() {
alert("stop");
$(this).hide();
$("#st-tree-container").show();
});
即使gif显示为旋转,也永远不会触发警报“开始”。AjaxStop如预期那样被触发。有什么想法吗?