我正在加载页面 url.php 并希望将 $x 传递给 url.php。
var myid=mydata.id;
$.ajax({
url:'url.php'
,async: true
,cache: false
, data : 'post_field=' + myid
,dataType: 'html'
,success: function(data){
$('body').html(data);
FB.XFBML.parse();
}
}
);
在 url.php
<?php
$myid=$_POST[myid];
echo "myID is : <br>";
echo myid;
?>
这里有什么问题?
给出错误:
<br />
<b>Notice</b>: Use of undefined constant myid - assumed 'myid' in <b>/opt/lampp/htdocs/FB/ec2/url.php</b> on line <b>2</b><br />
<br />
<b>Notice</b>: Undefined index: myid in <b>/opt/lampp/htdocs/FB/ec2/url.php</b> on line <b>2</b><br />
myID is : <br><br />
<b>Notice</b>: Use of undefined constant myid - assumed 'myid' in <b>/opt/lampp/htdocs/FB/ec2/url.php</b> on line <b>4</b><br />
myid<html>