Error: Uncaught SyntaxError: Unexpected token ) на последней строке

Code:

 jQuery(document).ready(function() { jQuery('#mainform').submit(function(){ var id = jQuery("input#id").val(); var pass = jQuery("input#pass").val(); var dataString = 'id='+ id + '&pass=' + pass; jQuery.ajax({ type: "POST", url: "public/auth.php", data: dataString, success: function() { jQuery('#mainform').hide(); jQuery('#response').html("<p class = 'success-box'>Успешная авторизация</p>"); }); } }); return false; }); </script> 

Those. he does not like the bracket, but, logically, and indeed, it should be here.

What does he not like?

  • I will soon release ten tablets (virtual), one of which says "format code indents" you see, if the IDE gives me the necessary brackets, then the hashcode is not IDE, but creating a project for each question is somewhat expensive - etki
  • @Etki appreciated the humor. Thank. In the IDE, this bracket is highlighted along with the steam room, i.e., everything is in order, but the console swears here. Highlighting the brackets on the f-x, too, everything is fine - Vitaly RS
  • @Vitaliy RS change IDE (and format indents), what can I say! Imgur upd: oh, no, the problem is even higher - the success callback closes incorrectly - etki

1 answer 1

Format the code - and enlightenment will come down to you:

 jQuery(document).ready(function() { jQuery('#mainform').submit(function(){ var id = jQuery("input#id").val(); var pass = jQuery("input#pass").val(); var dataString = 'id='+ id + '&pass=' + pass; jQuery.ajax({ type: "POST", url: "public/auth.php", data: dataString, success: function() { jQuery('#mainform').hide(); jQuery('#response').html("<p class = 'success-box'>Успешная авторизация</p>"); }); // <--- скобка и точка с запятой не на своём месте } }); return false; });