问问题
1018 次
2 回答
1
您在 ajax 函数中有错误..var 术语应该在 ajax 调用之外。数据应该是对象而不是字符串
尝试这个
...
else{
var term = $form.find( 'input[name="vrname"]' ).val(); //<---here declare it outside the ajax
//or
var term =$("#vrname").val(); //<--not sure what $form is but i think this should work
$.ajax({
type: "POST",
url: "nviewdetail.php",
data: { vrname: term }, //<--here this should be object
success:function(data){ //<--- callback function which is called whn ajax call succeed
//do your stuff
}
});
}
于 2013-09-05T05:35:27.803 回答
0
将以下代码用于 ajax:
function IsBlank_Post(){
var x = $("#vrname").val();
if (x==null || x==""){
alert("Company name must be filled out");
return false;
} else {
$.ajax({
type: "POST",
url: "nviewdetail.php",
data: {'vrname': x},
success: function(returnData){
alert("Successfull");
return true;
}
});
}
}
在页面nviewdetail.php你可以通过
$vrname = $_REQUEST['vename'];
于 2013-09-05T05:35:20.897 回答