我在firebug控制台中收到此错误,但不确定如何修复它。我确信它是一些括号问题但不确定如何纠正它。有人可以在我的代码中指出错误吗?感谢
$(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 :(得分:7)
$.post '/sample/admin/frm10010.php', data,
^---- Missing an opening brace
应该是
$.post( '/sample/admin/frm10010.php', data,