javascript - Like button without refreshing whole page -
i have create button in site. done using php. when clicks on like, increment count , changes 'unlike'. when click unlike count decrements.
the problem when click on button whole page refreshes. when clicked like,it goes page 'like.php' increment, decrement , other operations , come previous page. heard ajax/jquery possible refresh div without reloading whole page. how can it. new ajax/jquery. should avoid separate page 'like.php'?
$.post( "ajax/test.html", function( data ) { $( ".result" ).html( data ); }); https://api.jquery.com/jquery.post/
you can use .click click events. http://api.jquery.com/click/
Comments
Post a Comment