我想'延期'(停止表單的默認行爲)發送用戶到'http://www.othersite.com',直到服務器端驗證完成check.php使用JQuery做服務器端驗證,然後將用戶發送到另一個站點
一旦完成,發送用戶到他們的方式'http://www.othersite.com'。我可以發送到驗證頁面沒有問題,但我需要驗證然後發送到另一個網站。說我有這樣的
$(document).ready(function(){
$('#sendbutton').click(function(){
$('#error').empty();
$('#send').ajaxForm(function (data, textStatus) {
$('#error').append(data);
});
});
});
<form id="send" name="send" method="post" action="http://www.othersite.com/index.htm">
<input type="text" id="fname" name="fname" />
<input type="text" id="lname" name="lname" />
<input type="text" id="address" name="address" />
<input type="text" id="city" name="city" />
<input type="text" id="state" name="state" />
<button id="sendbutton">Submit</button>
</form>
<div id="error"></div>
和服務器端驗證表單上check.php
check field inputs here on check.php
if not correct
echo error message
if successful echo "validation_ok"
如果返回的數據是「validation_ok」然後發送用戶完成對「HTTP表單提交發生: //www.othersite.com'
返回的數據打開一個新頁面,並在那裏寫入錯誤消息,而不是在錯誤div中。我有jquery.form.js,干擾腳本嗎? – Patriotec
實際上,它仍然在我的測試頁上發佈到表單操作中設置的頁面 – Patriotec