In above ajax call the object jData returns null .. but returns the object successfully if displayed with success:
var jData = null;
function x() {
$.ajax({
url : 'http://...",
success : function(data) {
jData = data;
alert(jData); // displays the object
}
});
return jData; //returns null ??
};
$.ajax()is asynchronous. You have to work with jData directly in success callback