总结
豆包 AI 助手文章总结

ajax-我这段代码本页面可显示出传递的信息,但是在被传递页面中却无法接收到信息呢?谢谢!

php中文网
发布: 2016-06-02 11:34:01
原创
1058人浏览过

ajaxjavascriptpostjqueryphp

 <html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>Untitled Document</title><script type="text/javascript" src="jquery-1.3.2.js"></script><script type="text/javascript" src="json2.js"></script><script language="javascript">function checkemail(){  if($('#email').val() == ""){    $('#msg').html("please enter the email!");    $('#email').focus;    return false;  }  if($('#address').val() == ""){    $('#msg').html("please enter the address!");    $('#address').focus;    return false;  }  ajax_post(); }function ajax_post(){  $.post("http://localhost:8086/a1.1.php",{email:$('#email').val(),address:$('#address').val()},  function(data){    //$('#msg').html("please enter the email!");    //alert(data);    $('#msg').html(data);  },  "json");//这里返回的类型有:json,html,xml,text}</script></head><body><form id="ajaxform" name="ajaxform" method="post" action="a1.1.php">    <p>    email<input type="text" name="email" id="email"/>    </p>    <p>    address<input type="text" name="address" id="address"/>    </p>    <p id="msg"></p>    <p>            <input name="Submit" type="button" value="submit" onclick="return checkemail()"/>    </p></form></body></html>
登录后复制

被传递到的页面的代码为:

 <html><body><?php echo json_encode(array('email'=>$_POST['email'])); echo json_encode(array('address'=>$_POST['address']));?></body></html>
登录后复制
最佳 Windows 性能的顶级免费优化软件
最佳 Windows 性能的顶级免费优化软件

每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
豆包 AI 助手文章总结
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号