I am trying to use jquery-mockjax library to mock ajax, but I cannot see any response. My code is as follow :
<!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>
Is there anything I am missing?