2012-12-18 9 views
1

jQuery로 시작하기 때문에 나도 곰곰이 생각해 둡니다. 간과 할 수있는 아주 간단한 것일 수 있습니다. . 현재 개발중인 사이트의 로그인 양식이 있는데, ajaxSubmit을 사용하여 분실 한 비밀번호 요청에 대한 요청을 보내려고합니다. 이 요청은 모달 div의 양식에서 발생합니다.ajaxSubmit을 사용할 수 없습니다. TypeError : Object [object Object]에는 'ajaxSubmit'메서드가 없습니다.

형태 :

<div id="dialog" style="display: none" title="Retrieve your password"> 
     <p> 
      Please enter your username below and you will have a new password sent to the email address you registered with the account. 
     </p> 
     <form id="passform" action="comment.php" method="post"> 
      <input type="text" name="user" id="user"> 
     </form> 
    </div> 

jQuery를 제출하도록 요청 : catch되지 않은 형식 오류 : 나는 실제로 버튼을 쳤을 때

$(document).ready(function() 
     { 
      function doit(formData, jqForm, options) 
      { 
       // formData is an array; here we use $.param to convert it to a string to display it 
       // but the form plugin does this for you automatically when it submits the data 
       var queryString = $.param(formData); 

       // jqForm is a jQuery object encapsulating the form element. To access the 
       // DOM element for the form do this: 
       // var formElement = jqForm[0]; 

       alert('About to submit: \n\n' + queryString); 

       // here we could return false to prevent the form from being submitted; 
       // returning anything other than false will allow the form submit to continue 
       return true; 
      } 


      $("#getpass").click(function() 
      { 

       $("#dialog").dialog(
       { 
        autoOpen : true, 
        resizable : false, 
        height : 270, 
        modal : true, 
        hide : "fold", 
        show : "fold", 
        buttons : 
        { 
         "Retrieve Password" : function() 
         { 
          $("#passform").ajaxSubmit(
          { 
           url : "php/lostpassword.php", 
           type : "post", 
           success : doit 
          }); 
          return false; 
         }, 
         Cancel : function() 
         { 
          $(this).dialog("close"); 
         } 

        } 
       }); 

      }); 

     }); 

그러나, 나는 다음과 같은 콘솔 오류 얻을 개체 [개체 개체] 'ajaxSubmit'메서드가 없습니다.

ID가 모두 일치하고 관련 js 파일이로드되고 있음을 확인했습니다.

지금 아이디어가 부족합니다. 아무도 도와 줄 수 있습니까?

+0

플러그인을 사용하여 ajaxSubmit을 사용하고 있습니까? –

+1

플러그인을 사용하고 있습니까? ajaxSubmit이 Jquery Form Plugin의 일부이기 때문에 플러그인이 올바르게 포함되어 있는지 확인하십시오. –

+0

그래,이 머리가 있습니다 : Terrawheat

답변

1

내가 나중에 바보인데 오류가 발생했습니다./ 분명히 두 개의 다른 버전의 jQuery를 포함 시켰습니다.

1

ajaxSubmit 기능을 가진 jQuery Form 플러그인을 추가하여 동일한 오류 메시지가 표시되고 해결되었습니다.

관련 문제