欢迎来到山村网

iframe式ajax调用示例

2019-03-02 11:22:55浏览:859 来源:山村网   
核心摘要:想必大家对ajax调用有所熟悉,下面为大家介绍下iframe式ajax调用,需要的朋友可以参考下1.新建 a.html代码如下:!doctype htmlhtml

想必大家对ajax调用有所熟悉,下面为大家介绍下iframe式ajax调用,需要的朋友可以参考下

1.新建 a.html代码如下:<!doctype html><html><head><meta charset='utf-8'><title>iframe式ajax调用</title></head><body><form action='b.php' method='post' name='' id='' target='formTarget'><input type='text' name='username' id='' placeholder='' value='' /><input type='submit' name='' value='提交' /><span id='msg'></span></form><iframe src='' name='formTarget' id='formTarget' style='display:none'></iframe></body></html>2.新建 b.php代码如下:<?phpecho "<script>parent.document.getElementById('msg').innerHTML = 'iframe式ajax调用成功!';alert('您输入的是:{$_POST['username']}');window.setTimeout(function(){parent.window.location.reload();},3000);</script>";3.访问: http://localhost/a.html
(责任编辑:豆豆)
下一篇:

js对ajax返回数组的处理介绍

上一篇:

smart install maker实例

  • 信息二维码

    手机看新闻

  • 分享到
打赏
免责声明
• 
本文仅代表作者个人观点,本站未对其内容进行核实,请读者仅做参考,如若文中涉及有违公德、触犯法律的内容,一经发现,立即删除,作者需自行承担相应责任。涉及到版权或其他问题,请及时联系我们 xfptx@outlook.com