0
I made a system in Codeigniter that searches in real time. In my search, send the parameters via Ajax to the controller and do the query.
I send all the HTML to a view. Then I take all the HTML from this view by ajax and feed my page by replacing the current content with the new one. I made a 1 minute video showing the error:
https://www.youtube.com/watch?v=bRkY3JwBV-0
The mistake is that the Function that I did show/hide content (by clicking on the image) works before Ajax but does not work after Ajax that disappears with the current content and feeds the div with new content.
Function that ceases to function
$('a[href^="#"]').bind("click", function(event){
event.preventDefault();
var the_id = $(this).attr("href");
$(".detalhes").addClass('hide');
$("div"+the_id+"").parent(".detalhes").removeClass('hide');
$(".theblog ").removeClass("hide");
$(this).parents(".theblog").addClass("hide");
$('html, body').animate({ scrollTop:$(the_id).offset().top-25}, 'slow');
});
I was studying about elements that don’t exist and delegate these days and I think it has something to do with that matter, will someone help me to solve. I think I have to change this function to work in the elements that exist and that will exist.
Well, that’s it.