jeudi 4 décembre 2014

Ajax request not being sent


Vote count:

0




I'm currently creating a function that makes a POST request to an application. I have my JSON string correctly set up, but when I use the debugger and monitor network activity, I never see any request being sent from my browser. Here is a breakdown of my code. I had to do some trickery, as this is a PoC code, and it originally dealt with a jsp page.



$(document).ready(function() {

$("#myForm").submit(function(e) {
e.preventDefault();
var myJsonObject = new Object();
//set up my object and stringify it into myString

sendDataToServer(myString);
});

function sendDataToServer(jsonString) {
$.ajax({
type: "POST",
data: jsonString,
contentType: "application/json; charset=utf-8",
url: "http://ift.tt/1xXLCv2"
dataType : 'json',
processdata: true,
success: eval("successMessage"),
error: eval("failureMessage")
});
}

function successMessage() {
alert("Post was successful");
}

function failureMessage() {
alert("Post failed");
}
});


Now, my ajax call fails (still dealing with credential issues and certs), but I can't even see any request being sent from the start. Is my ajax call wrong, or is there some other problem? If I am denied access to the server due to cert issues, would it fail when trying to set up a connection to the server before sending any request?






asked 1 min ago







Ajax request not being sent

Aucun commentaire:

Enregistrer un commentaire