I want to submit Form ajax with jsontype
Let say I have 5 Field in that text box out of 5, 4 textbox normal Text one field value itself json so that ajax throw the error. How i can send
[![enter image description here][1]][1]
my.js
function _getTest(){
var data = JSON.stringify($("#formId").serialize());
//alert(data);
$.ajax({
url: "domain.com",
datatype: 'json',
type: "POST",
contentType: 'application/json',
data: data,
success: function(data) {
console.log(data);
},
error: function(result) {
alert(result.responseText);
}
});
}
After Submit form i got status this Status Code:400 Bad Request
General Tab Request URL:http://mycustomurl/com Request Method:POST Status Code:400 Bad Request Remote Address:35.154.113.130:8080 Referrer Policy:no-referrer-when-downgrade
[![enter image description here][2]][2]
Expected Payload
{
"name": "user",
"mobile": "1234567890",
"email": "my@gmail.com",
"address": "test",
"localityID": 1,
"cityID": 1,
"bookingDate": "2017-12-20",
"timingID": "1",
"paymentType": 1,
"affiliateID": 15,
"key": "test",
"password": "test",
"orderItems": [{
"id": 3,
"quantity": 2
}, {
"id": 4,
"quantity": 5
}]
}