需要帮助在jQuery代码中查找开括号

时间:2012-02-01 08:31:55

标签: jquery syntax-error brackets

我想知道是否有人可以帮我正确关闭代码。我试图在jsFiddle和页面上关闭它,但在某个地方,我是});

的任务之一

以下是以下代码,感谢您的帮助:

// validate form and submit
var $j = jQuery.noConflict();
$j(document).ready(function(){
$j("#myform").validate({
rules: {
ordernum2: {
required: true,
minlength: 12
},
messages: {
ordernum2: {
required: "Please a enter post code",
minlength: "Must be at least 12 digits"
}},
var url = "mypage.php";
var params = "id_order="+$j("#ordernum1").val();
$j.ajax({
type: 'POST',
url: url,
dataType: 'html',
data: params, 
cache: false,
beforeSend: function() {
$j('#workflow-column-3').html('<div style="background-position:center; background-image:url(../img/css/contact/spinner40.gif); background-repeat:no-repeat; padding: 25px 50px 50px 50px; height:100px"></div>');
},
complete: function() {
return false;
},
success: function(data) {
$j('#serial-required').hide(),
$j('#workflow-column-3').show(),
$j('#workflow-column-3').html(data);
}
});
};
});
});

1 个答案:

答案 0 :(得分:2)

您的规则对象缺少它的结束括号。

你有这个:

rules: {
ordernum2: {
required: true,
minlength: 12
}

应该是这样的:

rules: {
  ordernum2: {
    required: true,
    minlength: 12
  }
}