我试图在不重定向页面的情况下将数据提交到数据库。这段代码有错误吗?
$('#saving').on('click', function() {
var fname = $('#fname').val();
var lname = $('#lname').val();
var company = $('#company').val();
var mnum = $('#mnum').val();
var dataString = 'fname=' +fname + '&lname=' + lname + '&company=' + company + '&mnum=' + mnum;
$.ajax({
type: "POST",
url: "submit.php",
data: dataString,
success: function() {
alert('');
$('#dialog-message').dialog('open');
}
});
});