iframe式ajax調(diào)用示例
更新時間:2014年02月21日 15:14:47 作者:
想必大家對ajax調(diào)用有所熟悉,下面為大家介紹下iframe式ajax調(diào)用,需要的朋友可以參考下
1.新建 a.html
<!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
<?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
效果如圖
復(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控制所有后臺函數(shù)調(diào)用
- jQuery Ajax調(diào)用WCF服務(wù)詳細(xì)教程
- jQuery調(diào)用ajax請求的常見方法匯總
- 使用ajax技術(shù)無刷新動態(tài)調(diào)用新浪股票實時數(shù)據(jù)
- jQuery ajax調(diào)用WCF服務(wù)實例
- ajax的定時調(diào)用每5秒調(diào)用一次
- iframe式ajax調(diào)用示例代碼
- jquery中的ajax方法怎樣通過JSONP進(jìn)行遠(yuǎn)程調(diào)用
- JavaScript調(diào)用ajax獲取文本文件內(nèi)容實現(xiàn)代碼
- jquery.Ajax()方法調(diào)用Asp.Net后臺的方法解析
- ajax調(diào)用簡單實例
相關(guān)文章
AJAX和WebService實現(xiàn)省市縣三級聯(lián)動具體代碼
AJAX和WebService實現(xiàn)省市縣三級聯(lián)動效果,在瀏覽網(wǎng)頁的時候經(jīng)常會遇到過,下面與大家分享下具體的實現(xiàn)步驟2013-05-05Ajax?請求隊列解決方案并結(jié)合elementUi做全局加載狀態(tài)
這篇文章主要介紹了Ajax?請求隊列解決方案并結(jié)合elementUi做全局加載狀態(tài),使用 消息隊列 制作 請求防抖,防止重復(fù)請求印象服務(wù)器,本文通過實例代碼給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下2022-10-10