My Ajax is failing but Postman works?
I am sending a post request to a JSON api. If I test the remote script using PostMan (the Chrome extension), the results are perfect. However, when I try to manually post to the script using the following code:
-
$('#whateverPage').on( 'pagebeforeshow',function(event){
var myApi = 'http://api.domain.com/make';
$.post(myApi,
{
fname: "Kurt",
lname: "Vonnegut",
password: "kilgoretrout",
email: "foma@grandfaloon.com"
},
function(result){
$("#resultDisplay").html('<p><br><strong>Result: </strong>' + result.foma + '<br><strong>').trigger("create");
}, "json");
});
The api script lists all the required fields and tells me that I have not POSTed them. What could be the difference between my script and whatever PostMan sends?
cheers,
Wittner