为何PHP不能接收。

WBOY
Release: 2016-06-13 11:45:45
Original
936 people have browsed it

为什么PHP不能接收。。

 $.ajax({<br />       type: "POST",<br />        url: "index.php",<br />        data: "location=img_png_src",<br />        success: function(msg){<br />         alert( "Data Saved: " + msg );<br />           }<br />      });<br />
Copy after login

<?php echo $_POST["location"]; ?>
Copy after login


PHP接受不了 报错了 Notice: Undefined index: location in C:\wamp\www\makebanner\index.php on line 45
------解决方案--------------------
<?php<br />if($_SERVER['REQUEST_METHOD'] == "POST") {<br />  print_r($_POST);<br />  exit();<br />}<br />?><br /><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js"></script><br /><script><br />$(function() {<br /> $.ajax({<br />       type: "POST",<br />//        url: "index.php",<br />        data: "location=img_png_src",<br />        success: function(msg){<br />         alert( "Data Saved: " + msg );<br />           }<br />      });<br />});<br /></script><br />
Copy after login

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!