I can not execute Jquery after doing a load

2

After including a .html file inside a div with a load, the jquery code stops executing. Does anyone know why this happens and how to solve it?

$(document).ready(function(){

  var pathHtml = "src/html/";
  var left = pathHtml + "left/";

  function loadPage(section, page){
    $.ajax({
        type: "GET",
        url: "",
        beforeSend: function(){
            $(section).html("<div class='loader'></div>");
        },
        success: function(){
            $(section).load(page + ".html");
        }
    });
  };

  $("#wall").load(left + "wall.html");
  $("#url, .font-strong").click(function(){
    loadPage("#left", left + "profile");
  });
});
    
asked by garyeikoow 29.08.2016 в 20:23
source

1 answer

0

I do not understand why you need $.ajax() and within this a .load() , but I would change that way of calling the method in this way:

$("#url, .font-strong").click(function(){
  $("#left").html("<div class='loader'></div>");
  $.get(left + "profile", function(data) {
    $("#left").html(data);
  });
});

This way you forget about the method, where data is the page HTML , also verifies that within that html there is no instance of jQuery this would conflict with the library.

    
answered by 29.08.2016 / 22:19
source