Link to home
Start Free TrialLog in
Avatar of garethtnash
garethtnashFlag for United Kingdom of Great Britain and Northern Ireland

asked on

TypeError: $(this).fancybox.close is not a function. (In '$(this).fancybox.close()', '$(this).fancybox.close' is undefined)

Hello All,

I'm getting the following error in the console log -

TypeError: $(this).fancybox.close is not a function. (In '$(this).fancybox.close()', '$(this).fancybox.close' is undefined)

When I run the following JQuery -

  $("#Alert").submit(function(e){
      e.preventDefault();
    $.ajax({
		type: "POST",
        url: "/actions/emailnotification.asp",
        data:$(this).serialize(),
		success:function(result){
          if(result==1){
            // do something success
     		 $(this).fancybox.close();
			 location.reload();
          }else {
            // do something fail
	      $('#AlertError').html('<p>ErrorMessage here</p>');
          $('#AlertError').fadeIn('slow');
          }
  	  }});
  });

Open in new window


Any ideas?

Also I would like to briefly display a success message, before the fancy box closes?

Thank you
ASKER CERTIFIED SOLUTION
Avatar of zephyr_hex (Megan)
zephyr_hex (Megan)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of garethtnash

ASKER

Thank you - all sorted now :)