Нет ответа с jquery-mockjax
Я пытаюсь использовать библиотеку jquery-mockjax, чтобы высмеивать 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>
Есть что-то, что я пропускаю
2 ответа
Решение
У меня была та же проблема, и я полчаса колотил головой и кричал "почему?"
Попробуйте понизить jQuery до 1.*