使用jquerymockjax没有响应

使用jquerymockjax没有响应,jquery,mockjax,Jquery,Mockjax,我试图使用jquerymockjax库来模拟ajax,但我看不到任何响应。 我的代码如下: <!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <script src="components/jquery/jquery.js"></script> &

我试图使用jquerymockjax库来模拟ajax,但我看不到任何响应。 我的代码如下:

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <script src="components/jquery/jquery.js"></script>
    <script src="components/jquery-mockjax/jquery.mockjax.js"></script>
    <script>
        $(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');
                    }
                });
            }
            );
        });
    </script>
</head>
<body>
    <button id="btn">Get</button>
</body>
</html>

文件
$(函数(){
$.mockjax({
url:“/test/inline”,
contentType:“text/json”,
答复时间:0,
答复正文:{
说:“你好,世界!”
}
});
$('#btn')。单击(函数(){
$.ajax({
url:“/test/inline”,
键入:“获取”,
数据类型:“json”,
成功:函数(json){
警报('yousaid:'+json.say');
},
完成:函数(){
$.mockjaxClear();
警报(“已完成”);
}
});
}
);
});
得到
我有什么遗漏吗?

响应时间增加

responseTime: 10,

我也有同样的问题,头撞了半个小时,大叫“为什么?”


尝试将jQuery降级为1.*

我找到了原因。在将jquery版本降级到1.9.1之后,我使用了jquery版本>2.0,它可以工作!请将您的答案作为答案,而不是评论。另外,您使用的是哪个版本的mockjax?