Uncaught SyntaxError: missing ) 在参数列表之后即使代码是正确的

我收到上述错误。我检查了我的语法。代码中似乎没有任何遗漏。


1  <script language="javascript" type="text/javascript">

   2       $(document).ready(function(){

   3       

   4       $('#submit').on('click',function(){


   5      var from_date = $('#from_date').val();

   6     var to_date = $('#to_date').val();

   7      $.ajax({

   8     type:'POST',

   9     url:'date_based_report_action.php',

   10    data:'from_date='+from_date+'&to_date='+to_date,

   11    success:function(html){

   12    alert(html);

   13   $('#tabledata').html(html);  

   14   }

   15   });

   16   }

   17   }); 

   18   </script>

当我检查控制台时,错误显示在第 16 行。


慕盖茨4494581
浏览 147回答 1
1回答

莫回无

在第 16 行广告这个);,您缺少关闭函数 $('#submit').on('click',function(){ 完整代码如下:<script language="javascript" type="text/javascript">$(document).ready(function() {&nbsp; $('#submit').on('click', function() {&nbsp; &nbsp; var from_date = $('#from_date').val();&nbsp; &nbsp; var to_date = $('#to_date').val();&nbsp; &nbsp; $.ajax({&nbsp; &nbsp; &nbsp; type: 'POST',&nbsp; &nbsp; &nbsp; url: 'date_based_report_action.php',&nbsp; &nbsp; &nbsp; data: 'from_date=' + from_date + '&to_date=' + to_date,&nbsp; &nbsp; &nbsp; success: function(html) {&nbsp; &nbsp; &nbsp; &nbsp; alert(html);&nbsp; &nbsp; &nbsp; &nbsp; $('#tabledata').html(html);&nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; });&nbsp; });});</script>
打开App,查看更多内容
随时随地看视频慕课网APP