[jQuery] Can you please check why it's not working?

[jQuery] Can you please check why it's not working?


First of all, I'm a very very newbie here, I'm learning now,
I always have some problems when using jQuery for Ajax and for other things.
Maybe I'm not used to it yet, I'm always missing something.
Let's see this one, I can't figure out why this one doesn't work. When I
write script, I try to write everything and put them together in one file,
but its doesn't work. see below
function disappear() {
$("#response").fadeOut("slow")
}
$(document).ready(function() {
$("#message_me").click(function() {
$("#form").fadeIn("slow")
})
$("#send").click(function() {
var str = $("#input_form").serialize()
$.post("send-mail.php",str,function(data) {
$("#response").html(data).fadeTo("slow", 0.7)
setTimeout("disappear()", 3000)
})
})
$.get("counter.php", function(data) {
$("#counter").html(data).fadeIn("slow")
})
})
I saved the above script in a separate file, let's say "myscript.js". Then I
imported it in my html file like this
Then, when I run this, it's not working. I've been trying to find the error.
It says "missing } in XML expression at $("#send").... but then I switched
places between $("#send")... and $.get(..., then the error comes out like
"missing } XML expression at $.get(... instead. So I don't know what's
wrong, Is there any function that needs to be put in between somehow?
Again, now I delete everything except for $.get(.... in myscript.js. And I
put them in the html file manually like
function disappear() {
$("#response").fadeOut("slow")
}
$(document).ready(function() {
$("#message_me").click(function() {
$("#form").fadeIn("slow")
})
$("#send").click(function() {
var str = $("#input_form").serialize()
$.post("send-mail.php",str,function(data) {
$("#response").html(data).fadeTo("slow", 0.7)
setTimeout("disappear()", 3000)
})
})
})
Now then, it works fine.....
Can you tell me why it's not working in the uppermost one. cuz I want to put
everything in one script file, and not to show any script in the html file.
Besides, if I add ; afterwards, it doesn't work as well....T_T...Am I
missing something? or am I just to noob here?
Thank you very much for any responses, really appreciate your time.
DeaR
--
View this message in context: http://www.nabble.com/Can-you-please-check-why-it%27s-not-working--tp14773622s27240p14773622.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.