I have a webservice that expects to receive JSON, like so:
{"first_name":"test","last_name":"teste","email":"moi@someplace.com","mobile":"+44 22 2222 2222", "password":"testing"}
My AJAX call in jQuery:
$.ajax({
type: "POST",
url: hb_base_url + "consumer",
contentType: "application/json",
dataType: "json",
data: {
first_name: $("#namec").val(),
last_name: $("#surnamec").val(),
email: $("#emailc").val(),
mobile: $("#numberc").val(),
password: $("#passwordc").val()
},
success: function(response) {
console.log(response);
},
error: function(response) {
console.log(response);
}
});
Is there any way to check the format in which my data is being sent? I'm supposedly not sending correct JSON to the server (that is the first step in validation).
Is my jQuery code sending valid JSON or did I miss something?