1.新建 a.html
復(fù)制代碼 代碼如下:
!doctype html>
html>
head>
meta charset='utf-8'>
title>iframe式ajax調(diào)用/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
復(fù)制代碼 代碼如下:
?php
echo "
script>
parent.document.getElementById('msg').innerHTML = 'iframe式ajax調(diào)用成功!';
alert('您輸入的是:{$_POST['username']}');
window.setTimeout(function(){
parent.window.location.reload();
},3000);
/script>
";
3.訪問: http://localhost/a.html
效果如圖
您可能感興趣的文章:- ajax調(diào)用中ie緩存問題解決方法
- ajax+php控制所有后臺(tái)函數(shù)調(diào)用
- jQuery Ajax調(diào)用WCF服務(wù)詳細(xì)教程
- jQuery調(diào)用ajax請(qǐng)求的常見方法匯總
- 使用ajax技術(shù)無刷新動(dòng)態(tài)調(diào)用新浪股票實(shí)時(shí)數(shù)據(jù)
- jQuery ajax調(diào)用WCF服務(wù)實(shí)例
- ajax的定時(shí)調(diào)用每5秒調(diào)用一次
- iframe式ajax調(diào)用示例代碼
- jquery中的ajax方法怎樣通過JSONP進(jìn)行遠(yuǎn)程調(diào)用
- JavaScript調(diào)用ajax獲取文本文件內(nèi)容實(shí)現(xiàn)代碼
- jquery.Ajax()方法調(diào)用Asp.Net后臺(tái)的方法解析
- ajax調(diào)用簡(jiǎn)單實(shí)例