function load by ajax


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. const div_content="#containerMain";
  2. const img_loading="<div id='loading'><img src='images/loading.gif' /></div>";
  3.  
  4. function LoadContent(namecontent){
  5. $.ajax({
  6. url: base_url_include+namecontent,
  7. context: document.body,
  8. dataType: "html",
  9. cache: true,
  10. beforeSend: function(){
  11. $(div_content).html(img_loading);
  12. },
  13. success: function(html){
  14. $(div_content).html(html);
  15. }
  16. });
  17. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.