Reputation: 12385
Dreamweaver shows an error in the file
jquery.jig.js
the file is this
jQuery(document).ready(function(){
$('#contactform').submit(function(){
var action = $(this).attr('action');
$('#submit').attr('disabled','disabled').after('<img src="contact-form/assets/ajax-loader.gif" class="loader" />');
$("#message").slideUp(750,function() {
$('#message').hide();
$.ajax({
type:"POST",
url: "yourPhpFileURL.php", //put the url of your php file here
data: $('#contactform').serialize(),
success: function(data){
document.getElementById('message').innerHTML = data;
$('#message').slideDown('slow');
$('#contactform img.loader').fadeOut('fast',function(){$(this).remove()});
$('#submit').removeAttr('disabled');
if(data.match('success') != null) $('#contactform').slideUp('slow');
if(data.match('success') != null) $("html,body").animate({
scrollTop: $("#message").offset().top
}, 1000, function(){
});
if(data.match('success') == null) $("html,body").animate({
scrollTop: $("#message").offset().top
}, 1000, function(){
//scroll complete function
});
}
});
});
return false;
});
});
The error is showed in the last line, but I cannot understand the reason.
Upvotes: 0
Views: 479
Reputation: 7722
I ran your code through jsfiddle's JSLint syntax analyzer, and fixed a few errors and etc. So far, the below validates fine. Please check it on your end:
jQuery(document).ready(function() {
$('#contactform').submit(function() {
var action = $(this).attr('action');
$('#submit').attr('disabled', 'disabled').after('<img src="contact-form/assets/ajax-loader.gif" class="loader" />');
$("#message").slideUp(750, function() {
$('#message').hide();
$.ajax({
type: "POST",
url: "yourPhpFileURL.php",
//put the url of your php file here
data: $('#contactform').serialize(),
success: function(data) {
document.getElementById('message').innerHTML = data;
$('#message').slideDown('slow');
$('#contactform img.loader').fadeOut('fast', function() {
$(this).remove();
});
$('#submit').removeAttr('disabled');
if (data.match('success') !== null) {
$('#contactform').slideUp('slow');
}
var msg_offset = $("#message").offset().top;
if (data.match('success') !== null) {
$("html,body").animate({
scrollTop: msg_offset
}, 1000, function() {
});
}
if (data.match('success') === null) {
$("html,body").animate({
scrollTop: msg_offset
}, 1000, function() {
//scroll complete function
});
}
}
});
});
return false;
});
});
Upvotes: 1