这段代码
$("#loading").ajaxStart(function() {
alert("start");
$(this).show();
});
在我的标记
![](../images/common/loading.gif)
以下是完整的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按预期触发.
任何想法为什么?