I have the following request
amplify.request.define("checkout#update", "ajax", {
url: "checkout/update/{orderId}",
dataType: "json",
type: "POST",
contentType: "application/json; charset=utf-8"
});
I then use the request as so
amplify.request("checkout#update", { orderId: this.orderGuid(), items:
JSON.stringify(data) }, function (result) {
alert(data);
});
Which I would like to post JSON to my controller. Instead it is
posting url encoded values which breaks model binding. I have this
working with JQuery as so
$.ajax({
type: "POST",
url: 'checkout/update/' + this.orderGuid(),
contentType: "application/json; charset=utf-8",
dataType: "json",
data: JSON.stringify(data),
success: function (data) {
alert(data);
}
});
This posts the json string back but amplify seems to get in the way,
unpack the json string and urlencode it. Any idea what i'm doing
wrong?
Thanks,
Ian
Here is a fiddle. You can see that using jquery the request is made
and is sent as json. The amplify request sends as a url encoded string
with exactly the same data.
Thanks,
Ian