February 2015
Intermediate to advanced
232 pages
4h 40m
English
Once you have mocked the HTTP call, you need to send some data in the response. You have different possibilities:
responseText attribute of the $.mockjax call:$.mockjax({
url: '/products',
type: 'GET',
dataType: 'json',
responseTime: 750,
responseText: ['Here I can fake the response']
});$.mockjax({
url: '/products',
type: 'GET',
dataType: 'json',
responseTime: 750,
response: function(settings) {
var fake = 'We fake the url:'+settings.url;
this.responseText = fake;
}
});This third option can be performed with a library called mockJSON. You can download ...
Read now
Unlock full access