Posted By

Savio on 02/08/11


Tagged

basic ajax jquery load


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Some0ne


Basic AJAX load with jQuery


 / Published in: jQuery
 

  1. <script type="text/javascript">
  2. $(function()
  3. {
  4. $('#link a').click(function(e) {
  5. var url = $(this).attr('href');
  6. $('#elementToLoadContentInto').load(url);
  7. e.preventDefault();
  8. });
  9. });
  10. </script>
  11.  
  12. HTML:
  13.  
  14. basic list like
  15. <ul>
  16. <li><a href="#" id="link">blabla</a></li>
  17. </ul>
  18. <div id="elementToLoadContentInto">
  19. blablabla
  20. </div>

Report this snippet  

You need to login to post a comment.