2015-10-17 104 views
1

我有POST方法是這樣的一個HTML表單:PHP和HTML - 如何使用iframe進行重定向頁面

<form action="xml.php" method="post"> 
    <textarea rows="15" cols="30" name="user"></textarea> 
    <input type="submit" value="Export to xml"> 
</form> 

當用戶按下submit按鈕頁面重定向到xml.phpxml.php「用戶輸入會改變內容的內容。 (POSTing方法)

我想爲xml.php使用iframe標記但我不知道如何? ,因爲它重定向到xml.php我們如何iframe結果xml.php在當前頁面? (顯示當前頁面的xml.php的結果)

回答

1

您可以製作一個ajax文章到xml.php,然後打印返回的結果。

如:http://api.jquery.com/jquery.ajax/

如果你想使用iframe然後

<form action="xml.php" method="post" target="my_iframe"> 
    <textarea rows="15" cols="30" name="user"></textarea> 
    <input type="submit" value="Export to xml"> 
</form> 

<iframe name="my_iframe" src="xml.php"></iframe> 

注重該iframe的內容加載時頁面加載,所以也許你想隱藏的iframe,然後顯示後該職位。

同類問題: How do you post to an iframe?