html - How to stay in the same page when we use jquery load -


this example file:

<html > <head> <script type="text/javascript" src="js/jquery.js"></script> <script> $(document).ready(function() { $('#hr').click(function() { $('#main').load('show.php');  }); }) </script> </head> <body> <div id="hr"></div> <div id="main"></div> </body> </html> 

in show.php file have submit button , when load file in div , when click submit button take me home page , mean div load show.php file disappear, want when click submit button don't want change in page.

you need submit button return false, e.g.:

<input type="submit" onclick="dostuff(); return false;" /> 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -