你好朋友这是我的代码。
$.post("submit_investorform.php",{'flage':'firstOverviewsubmit','comname':comaname,'amoutwisr':amoutwisr,'user_id':<?php echo $value = isset($_GET['user_id']) ? $_GET['user_id'] : ""; ?>},function(result){
if(result.trim() == 'Insert'){
$(".noterror").html("Record Insert Successfully");
$(".noterror").show();
return false;
}else if(result.trim() == 'error'){
$(".errordisplay").html("Something was Wrong Please Try Again");
$(".errordisplay").show();
return false;
}else if(result.trim() == "update"){
$(".noterror").html("Record Updated Successfully");
$(".noterror").show();
return false;
}
});
我想做user_id设置然后发送到 POST 请求,否则它会发送空白。但 jQuery 返回语法错误。
请帮忙。
试试这个
'user_id': '<?php echo $value = isset($_GET['user_id']) ? $_GET['user_id'] : ""; ?>'
如果未设置$_GET['user_id']
,则需要将PHP
代码包装在引号内以避免语法错误。