第1頁輸入文本:test.php的(彈出式窗口中打開)插入PHP的結果從一個頁面從另一個頁面JS
<script type="text/javascript">
function addFiles(aFiles) {
if ($('#addfiles').length==0) $('#addfiles').html;
for (var i=0;i<aFiles.length;i++) $("#addfiles").append(""+aFiles[i].file+"");
}
</script>
<?php
$result = "<div id=\"addfiles\"></div>"; (everything works good here, i have only one result)
?>
第2頁:results.php(主頁,打開)
<input type="texta" name="texta" id="texta" value="<? echo $result; ?>"/>
(我需要值=「」是汽車用$結果更新時,$結果有一定的結果,而不刷新頁面所有。)
感謝
編輯:
function addFiles(aFiles) {
if ($('#addfiles').length==0) $('#addfiles').html;
for (var i=0;i<aFiles.length;i++) $("#addfiles").append(""+aFiles[0].file+"");
(window.opener.location = 'http://www.example.com/value='+aFiles[0].file+'');
self.close();
}
現在工作很好。由於
謝謝,但我需要更新第二頁value =「」,而不刷新所有頁面,以及某種方式如何獲得此$結果,在另一頁關閉後。 – user1033986
好吧,如果你不希望整個頁面刷新,你需要運行一個AJAX函數,該函數在子窗口關閉後從預定位置獲取值。 –
任何請檢查,謝謝。我是AJAX的新手。我被卡住了。 – user1033986