没有回应jquery-mockjax
我试图使用jquery-mockjax库来模拟ajax,但我看不到任何响应。 我的代码如下:
Document $(function(){ $.mockjax({ url: '/test/inline', contentType: "text/json", responseTime: 0, responseText: { say: 'Hello world!' } }); $('#btn').click(function(){ $.ajax({ url: '/test/inline', type: "GET", dataType: 'json', success: function(json) { alert('You said: ' + json.say); }, complete: function() { $.mockjaxClear(); alert('completed'); } }); } ); });
有什么我想念的吗?
我遇到了同样的问题,正在敲打我的头半小时,大喊“为什么?”
尝试将jQuery降级为1. *
ResponseTime增加。
responseTime: 10,