B
B
bijo12017-04-20 13:27:55
JavaScript
bijo1, 2017-04-20 13:27:55

TypeError: undefined is not an object (evaluating '$.fancybox.open')

I tried to hang a modal window on the "order" button using fyncybox, but I got this error TypeError: undefined is not an object (evaluating '$.fancybox.open')
Below is the code itself...

//form submit
$(function( ){
$('#order-form').on('submit', function(e){
e.preventDefault();

var
form = $(this),
formData = form.serialize();

$.ajax({
url: '../config/mail.php',
type: 'POST',
data: formData,

success: function (data) {

var popup = data.status ? '#success' : '#error';

$.fancybox .open([
{ href: popup }
],{
type: 'inline',
maxWidth : 250,
fitToView : false,
padding : 0,
afterClose : function () {
form.trigger('reset');
}
});
}
})
});

$('.status-popup__close').on('click', function(e){
e.preventDefault();
$.fancybox.close();
});
});

Letters come, but the modal window from fyncybox does not appear

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
ThunderCat, 2017-04-20
@bijo1

Almost everyone has come across, usually the error is banal, duplication / non-connection of the script, incompatibility with jq or jq.min, messed up with redefining $(), rarely a typo in the config or connecting to the wrong element, everything is verifiable, it just takes time.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question