【发布时间】:2014-04-25 21:41:38
【问题描述】:
这是我的使用Jquery blockUI插件的js:
$(document).ajaxStop($.unblockUI);
$('#submit-id-submit').click(function() {
$.blockUI({message:'<h1><img src="{% static 'css/spinner.gif' %}" /> Just a moment ...</h1>'});
$.ajax({
url: "/search/test/",
cache:'false',
dataType: 'text',
type:"GET",
success: function(data){
alert(data);
},
error: function(data){
alert('error; '+ eval(error));
}
});
});
我的看法:
def test_ajax(request):
time.sleep(20)
print "in test_ajax"
return HttpResponse("hell world")
url(r"search/test/$", test_ajax,name="dummy"),
首先,我看到 ajax 调用返回错误(因为我从错误中得到警报。但它没有显示错误消息)
其次,我的视图 test_ajax 没有被调用,因为我希望那里的打印语句被执行,但它没有执行。
我不知道这里出了什么问题。
【问题讨论】:
-
你能在你的警报上设置一个断点,比如在 Chrome 的开发工具中,检查错误并发布它吗?