关于PHP和Ajax的有关问题

WBOY
Release: 2016-06-13 11:39:46
Original
759 people have browsed it

关于PHP和Ajax的问题
QT.php

<script></script>
<script><br />var sendData = {<br /> 'name':'a',<br /> 'psw':'b'<br /> };//构造post数据 <br />$.post('HT.php',sendData,function(data) {//实现ajax <br /> if(data.indexOf('error')!=-1) //data是你在php 端 echo的信息<br /> {<br /> alert('发生错误'); <br /> return false;<br /> }else{<br /> alert(data);<br /> }<br />}); <br /></script>


HT.php


$name=$_REQUEST['name'];
echo $name;
?>

以上有两个文件
一个QT.php
一个HT.php
我在本地电脑实验时
可以省略$name=$_REQUEST['name'];这一句
但把文件传到服务器后就要加上这句才行
是什么原因呢?

php ajax
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