This default code is working fine:
$('#headerLink').fancybox({
'ajax' : {type : "GET" }
});
But I want to use delegate:
$('#header').delegate('#headerLink', 'click', function(){
$.fancybox({
'ajax' : {type : 'GET'}
});
});
It appears to load at first but instead of the content it just displays this message:
“The requested content cannot be loaded. Please try again later.”
Then it unloads, and just redirects to the url for the link.
I tried changing the syntax to $(this).fancybox({ ....
I also tried using ‘live’ but this doesn’t work either..
$('#headerLink').live('click', function(){
$.fancybox({
'ajax' : {type : "GET" }
});
Any help with this really appreciated..
Just change your code to refer to
aelement inside your delegate: