sampadclub
New Member
Yeah, so I have NO CLUE what happened. I've been writing an AJAX comment script and I got it working, except it doesn't work anymore. I restored it from a backup just in case I chaged anything, but no luck. It goes to the "action" of the form instead of the jQuery, even though I have \[code\]return false;\[/code\] This leads me to believe that one of the following things is wrong: I'm not including the jQuery correctly (which I am) or I have a syntax error. Do you see anything?\[code\]$(document).ready(function() { $("#alert").hide(); $('form').submit(function() { $("#alert").slideUp().delay(1000); name = $('input[name=name]').val(); email = $('input[name=email]').val(); timestamp = $('input[name=timestamp]').val(); entry_title = $('input[name=entry_title]').val(); message = $('textarea[name=message]').val(); $.post("/scripts/ajax_comment.php", {comm_name:name, comm_email:email, comm_message:message, comm_timestamp:timestamp, comm_entry_title:entry_title}, function(data){ switch(data) { case "invalid email" : $("#alert").val("").append("Invalid E-mail address.").slideDown(); break; case "empty field" : $("#alert").val("").append("Make sure no fields are empty.").slideDown(); break; case "error" : alert("error"); break; default: $(data).appendTo("#messages").hide().slideDown().animate({ color: "#669900" }, 1000).animate({ color: "#000000" }, 1000); } }); return false; });}); \[/code\]SOLVED: The problem was the delay(1000);