I try to have some content loaded on Wordpress thanks to Jquery .load()
. Sometimes, when my code is OK, it's not working anymore the day after...
I'm trying to narrow the causes. First I thought it was a syntax problem or a single/double quote mix up, but since it worked once, there is no reason syntax or error is involved. I thought about bad cache settings but shift+F5 won't break my working code.
And now I just tried, with a perfectly working code, to close and restart WAMPserver. And Bingo, when I restart the server it's impossible to get my load function to work (the same from 1 min before...) !
EDIT: I just replaced the code (below) with the one I'm using now
$(document).ready(function(){
$.ajaxSetup({cache:false});
$("#portfolio-list li:not(#DrawerContainer)").click(function(){
var post_link = $(this)
//.parentsUntil(".ProjectWrap")
//.parent()
.find('.mosaic-backdrop')
.attr("href");
console.debug(post_link); //to get post_link info in the console
$('#DrawerContainer').remove(); // remove existing, if any
$('<li/>').attr('id', 'DrawerContainer').css({display: 'none'}).data('citem', this).html("loading...").load(post_link + " #container > * ").insertAfter(LastInRow).slideDown(500);
return false;
});
});
When the function isn't working, I try to remove the part .load(post_link + " #container > * ");
and replace it with the part just after (a complete url). Usually it works and at least I can continue styling my page, but I have to fix the problem.
What can cause this weird behavior? Can WAMPserver rewrite something while closing? Is there an option I could check?