February 2015
Intermediate to advanced
232 pages
4h 40m
English
Once you can communicate with the server to manage our products, it's time to send the order. For this purpose, follow these instructions:
resources/OrderResource.js with this content:'use strict';
var OrderResource = (function () {
function create(order) {
return $.ajax({
type: 'PUT',
url: '/order',
data: order
});
}
return {
create: create
};
})();mocks/order.js and adding this code:$.mockjax({
type: 'POST',
url: '/order',
status: 200,
responseTime: 750,
responseText: {
'data': {
text: 'Order created'
}
}
});finishOrder method in the viewmodel.js file:var finishOrder = function() { OrderResource.create().done(function(response){ cart([]); visibleCart(false); ...Read now
Unlock full access