2010-04-26 3 views
0

JQuery 1.3을 사용하여 유효성을 검사하고 양식을 PHP 페이지로 제출하여 JSON이 원본 양식 페이지에 표시 할 서버 응답을 인코딩합니다.JQuery 양식이 Ajax 표시기가 켜져 있고 제출하지 않습니다

JQuery 파트없이 양식을 제출하려고했지만 모든 것이 잘 작동하는 것처럼 보이지만 JQuery를 추가하면 제출되지 않고 지속적으로 Ajax 표시기가 표시됩니다. 나는 장애인 텍스트 상자 및 일부 숨겨진이


$(document).ready(function(){

var options = { target: '#messagebox',
url: 'updateregistration.php',
type:'POST', beforeSubmit: validatePassword, success: processJson, dataType: 'json'
}; $("form:not(.filter) :input:visible:enabled:first").focus(); $("#webmailForm").validate({

errorLabelContainer: "#messagebox", rules: { forename: "required", surname: "required", currentpassword: "required", directemail: { required: true, email: true }, directtelephone: "required" }, messages: { forename: { required: "Please enter your forename
" }, directemail: { required: "Please enter your direct e-mail address
", email: "Your e-mail address does not appear to be valid
(Example: [email protected])
" }, surname: { required: "Please enter your surname
" }, directtelephone: { required: "Please enter your direct telephone number
" }, currentpassword: { required: "Please enter your current password
" }

}

});

$('#webmailForm').submit(function() {

$('#ajaxindicator').show();

$(this).ajaxSubmit(options); 

    return false; 
}); 

});

function processJson(data) { $("#webmailForm").fadeOut("fast"); $("#messagebox").fadeIn("fast"); $("#messagebox").css({'background-image' : 'url(../images/messageboxbackgroundgreen.png)','border-color':'#009900','border-width':'1px','border-style':'solid'}); var forename=data.forename; var surname=data.surname; var directemail=data.directemail; var directphone=data.directphone; var dateofbirth=data.dateofbirth; var companyname=data.companyname; var fulladdress=data.fulladdress; var telephone=data.telephone; var fax=data.fax; var email=data.email; var website=data.website; var fsanumber=data.fsanumber; var membertype=data.membertype; var network=data.network;

$("#messagebox").html('<h3>Registration Update successful!</h3>' + '<p><strong>Member Type:</strong> ' + membertype + '<br>' + '<strong>Forename:</strong> ' + forename + '<br><strong>Surname:</strong> ' + surname + '<br><strong>Direct E-mail:</strong> ' + directemail + '<br><strong>Direct Phone:</strong> ' + directphone + '<br><strong>Date of Birth:</strong> ' + dateofbirth + '<br><strong>Company:</strong> ' + companyname + '<br><strong>Address:</strong> ' + fulladdress + '<br><strong>Telephone:</strong> ' + telephone + '<br><strong>Fax:</strong> ' + fax + '<br><strong>E-mail:</strong> ' + email + '<br><strong>Website:</strong> ' + website + '<br><strong>FSA Number:</strong> ' + fsanumber + '<br><strong>Network:</strong> ' + network + '</p>'); 

$('#ajaxindicator').hide();

}

function validatePassword(){ var clientpassword=$("#clientpassword").val(); var currentpassword=$("#currentpassword").val(); var currentpasswordmd5=hex_md5(currentpassword); if (currentpasswordmd5!=clientpassword){ $("#messagebox").html("You input the wrong current password, please try again."); $('#ajaxindicator').hide(); return false; } }

:

여기 내 코드입니다. 이것이 문제가 될 수 있습니까? 숨길

답변

0

시도/아약스 요청의 상태에 쇼 진행 표시 줄이 코드를 확인하십시오 :

jQuery(document).ajaxSend(function(){ 
    jQuery("#loading-mask").show(); 
    }); 

jQuery(document).ajaxComplete(function(){ 
    jQuery("#loading-mask").hide(); 
}); 

가 $ ('#의 ajaxindicator')을 제거 쇼();. 내 코드에서

+0

감사합니다. Chirag! 나는 $ ('# ajaxindicator')를 꺼냈다. 코드에서 이제 표시기가 초 동안 표시되고 사라집니다. 양식은 여전히 ​​제출되지 않습니다. –

관련 문제