I have an ajax call. I put the return value (data) in a variable called mydata. I would like to use that variable outside the ajax call. Do note that I can not incorporate my code in the success part of the ajax call. I will not detail the reasons as it will add confusion. So the question is simple. Is there a way to use the return value of an ajax call outside that ajax call? Thank you in advance for your replies. Cheers. Marc
$.ajax({
type: "POST",
url: "file.php",
data: ajaxData,
success: function(data) {
var mydata = data;
}
});
alert(mydata); // -> This is not working