function ajax(){
var productId = $('#product_id').val();
var incId = $('#inc_id').val();
var flag = 0;
if(productId != null && productId!="" && incId != null && incId!="")
{
$.ajax({
async:false,
type:"POST",
url: "/detection/detection.action?action=ajax&product_id="+productId+"&inc_id="+incId,
success: function(data){
var number = 0;
var number1 = 0;
eval(data);
if(number <= 0)
{
alert("产品审核未通过");
} else if(number1<=0)
{
alert("专业承包企业审核未通过");
} else
{ flag =1;
}
}
});
if(flag ==1 )
{
return false;
} else
{
return true;
}
} else
{
return false;
}
}
flag的值在回调函数若做了改变,变成1,主函数中可以得到1.