I'm using mockjax to simulate an Ajax call, but I'm experiencing that the data received by my Ajax callback is different from what I pass to mockjax (via the 'responseText' parameter). In this example, I've chosen the response to be '14.0', but the callback receives '14' instead:
$.mockjax({
url: "/test",
contentType: "text/json",
responseText: "14.0"
});
$.ajax({
url: "/test",
datatype: "json"
}).done(function(data) {
alert(data);
});
Why is it that the received data is different from what I specify to responseText
? See this fiddle for a working example; a popup dialog will show the string received by the callback, should be '14'.
EDIT:
This is the popup I get when running the fiddle, demonstrating the altered response from mockjax.
Also fixed the fiddle.