最初用ajax,普通的內容都是能夠的,可是會遇到文件上傳的問題。ajax應該也是能夠處理的,我也沒去深究。
php
考慮換種方式處理,即頁面提交 target到 隱藏的iframe 中 ,此時頁面是不會跳轉的也是實現了數據傳遞html
如 ajax
<form action="xxx.php" method="post" enctype="multipart/form-data" target="frameFile" onsubmit=" return check()"> ........ <input type='submit' name='sub' value='提交'> </form> <iframe name="frameFile" id="frameFile" style="display:none"></iframe>
處理過數據 能夠對 submit經行提示處理 以後跳轉仍是不跳轉隨意函數
<?php /** * by wkj 2016-01-06 * //隨手封的函數,可根據須要修改 * 功能:提醒函數 點擊提交表單 提交文字變成設置的如(已提交成功)持續3秒以後跳轉 * $time 定時時長 * $bt_id submit id * $bt_old 最終顯示文字 * $bt_notice 定時期間提示文字 */ function altN($time,$bt_id,$bt_old,$bt_notice){ echo "<script> altN(".$time.",'".$bt_id."','".$bt_old."','".$bt_notice."'); function altN(altTime,bt_id,bt_old,bt_notice){ parent.document.getElementById(bt_id).value=bt_notice; altTimes(altTime,bt_id,bt_old) function altTimes(altTime,bt_id,bt_old){ var set = setInterval(function () { altTime --; if(altTime == 0) { clearInterval(set); parent.document.getElementById(bt_id).value=bt_old } }, 1000); } } </script>"; } altN(2,'sub','提交','已提交成功'); echo "<script>parent.history.go(-1)</script>"; die;