2013-07-08 169 views
-2

我在螢火蟲控制檯得到這個錯誤,不知道如何解決它。我相信這是一些括號問題,但不知道如何糾正它。有人可以指出我的代碼中的錯誤嗎?感謝;之前聲明錯誤

$(function() 
{ 

    $.validator.setDefaults(
    { 
     errorClass: 'form_error', 
     errorElement: 'div' 
    }); 

    $("#frmreport").validate(
    { 
     rules: 
     { 

      dept: 
      { 
       required: true 
      }, 
      email: 
      { 
       required: true 
      }, 
      position: 
      { 
       required: true 
      }, 
      feedback: 
      { 
       required: true 
      } 
     }, 
     messages: 
     { 

      dept: 
      { 
       required: "<br />* required: You must select a department" 
      }, 
      email: 
      { 
       required: "<br />* required: You must select a customer address" 
      }, 
      position: 
      { 
       required: "<br />* required: You must select a service level" 
      }, 
      feedback: 
      { 
       required: "<br />* required: You must enter a box number for intake" 
      } 
     }, 

     submitHandler: function() 
     { 
      if ($("#frmreport").valid() === true) 
      { 
       var data = $("#frmreport").serialize(); 
       $.post'/sample/admin/frm10010.php', data, function(msg) 
       { 

        var messageOutput = ''; 
        for (var i = 0; i<msg.length; i++) 
        { 
         messageOutput += msg[i].box+' ';  
        } 
        $("#confirm_department").hide(); 

        var $dialog = $('<div id="dialog"></div>').html('Your report was successfully submitted and a representative will respond to you shortly.<br /><br />Thank you.'); 
        $dialog.dialog({ 
         autoOpen: true, 
         modal: true, 
         title: 'Report submission successfull', 
         width: 400, 
         height: 200, 
         draggable: false, 
         resizable: false, 
         buttons: { 
          Close: function() 
          { 
           $(this).dialog("close"); 
          } 
         } 
        }); 

       $("#frmreport").get(0).reset(); 
       }, 'json'); **<--- error is here** 

      } 
      else 
      { 
       return; 
      } 
     }, 
     success: function(msg) 
     { 
       //$("#BA_addbox").html("You have entered a box"); 
       //$("#BA_boxform").get(0).reset(); 
     } 

    }); 
}); 
+0

把你的整個腳本,複製/粘貼到http://www.jsFiddle.net ** **的JavaScript部分,然後點擊** JSHint **按鈕。 – DevlshOne

+0

分析你的代碼 - 過分苛刻,但通過你的代碼,你會發現這些東西 – sipp

回答

7
$.post '/sample/admin/frm10010.php', data, 

     ^---- Missing an opening brace 

應該是

$.post('/sample/admin/frm10010.php', data, 
相關問題