php - Error on $.post of Form -


i trying submit form using jquery php page. following error when try run script chrome:

 uncaught syntaxerror: unexpected token ; jquery-latest.js;614 

line 614 part of globaleval function.

globaleval: function( data ) { if ( data && rnotwhite.test( data ) ) { // use execscript on internet explorer // use anonymous function context window // rather jquery in firefox ( window.execscript || function( data ) { window[ "eval" ].call( window, data ); // **** uncaught syntaxerror: unexpected token ; **** // } )( data ); } }, 

this code form , jquery submit.

<div class="container create-event"> <form name="new-event" method="post" id="new-event"> name of event: <input type="text" name="event-name"></br> date of event: <input type="date" name="date"></br> location of event: <input type="text" name="location"></br> description: <textarea cols="50" rows="5" name="description"></textarea></br> <a href="#" id="event-submit" class="button red">submit</a> <script type="text/javascript"> $('#new-event').submit(function() { $.post( 'post-event.php', $(this).serialize(), function(data){ $('#results').html(data); } ); return false; }); $('#event-submit').click( $(this).parents('form:first').submit(); ); </script> </form> <div id="results"></div> </div> 

then 'post-event.php' script this:

<?php echo "hello"; ?> 

any appreciated.

$('#event-submit').click( $(this).parents('form:first').submit(); ); 

after changing click function code below worked me.

$('#event-submit').click(function(){ $(this).parents('form:first').submit(); }); 

you missing function() reference.


Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -