function IsSwap()
{
var urlString = "<%= System.Web.VirtualPathUtility.ToAbsolute("~/mvc/Indications.cfc/GetModelType")%>";
var id =
{
id : GetGUIDValue()
}
$.ajax({
type: "POST",
url: urlString,
data: id,
success: function(data) {
if (data.toString() == 'SwapModel')
{
return true;
}
}
});
Expected result is true. I can alert right before the return so I know it's getting to that point fine. In another function, I tried to get my bool and use it like this:
var isSwap = IsSwap();
if (isSwap)
and it keeps saying isSwap is undefined. Why?
IsSwapdoes not return a value, so the function returnsundefined. Thereturn trueis from the Ajax success callback, notIsSwap.