I need to return true or false to my alert() from the results of an ajax success function. However, I'm having problems since the alert() result is always 'undefined'...any ideas on how to fix this?
I have DoAjax as it's own function because I call it multiple times within the .js file.
var val = '12345';
alert( DoSerialVerification( val ) ); //this returns 'undefined' regardless of cType.length
function DoSerialVerification( piVal ){
var fSuccess = function( oData ){
var cType = oData.type
if( cType.length > 0 ){
alert( cType ); //with piVal = 12345 cType will return 'MODULE'
$('#dialog-1').attr('type', cType);
return true;
} else {
return false;
}
};
DoAjax({ Action: "DoSerialVerification", Value: piVal }, fSuccess );
}
function DoAjax( pAjaxParams, pSuccess ){
$.ajax({url : 'procedures?',
data : pAjaxParams,
async : false,
type : "POST",
dataType : "json",
error : function(oD,oT,oE){ alert( oD+'\n'+oT+'\n'+oE ) },
success : pSuccess
});
}
procedures?is returning data?