After including a .html file inside a div through a load, the jquery code stops executing. Does anyone know why this happens and how to fix 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");
});
});
I don't understand why you need
$.ajax()
and inside this a.load()
, but I would change that way of calling the method in this way:So you forget about the method, where
data
is the pageHTML
, it also checks that within thathtml
there is not an instance ofjQuery
this would conflict with the library.