我在下面有这段代码,假设是通过 Jquery 的帖子提交表单。
<script>
/* attach a submit handler to the form */
$("#contactForm").submit(function(event) {
/* stop form from submitting normally */
event.preventDefault();
/* get some values from elements on the page: */
var $form = $( this ),
url = $form.attr( 'action' );
/* Serialize Data */
var senddata = $form.serializeArray();
/* Send the data using post */
var posting = $.post( url, senddata);
/* Put the results in a div */
posting.done(function( data ) {
var content = $( data ).find( '#content' );
$( "#result" ).empty().append( content );
});
});
</script>
但是每次我尝试提交时,我都会在控制台中收到此错误:
错误:语法错误,无法识别的表达式:数组([name] => name [email] => dsf@dsfsd.com [number] => 23456567 [query] => query)
有什么建议么?
谢谢。