I had a little problem with $.post()
The following is the code that i've used for a file , try.htm :
<head>
<script type = "text/javascript"
src = "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type = "text/javascript">
function yo(){
var text = $("#msg").val();
$.post("chat.php",msg:text);
}
</script>
</head>
<body>
<input type="text" id="msg" onkeyup="yo()">
<div id="display">Change</div>
</body>
And the following is the code for chat.php :
<?php
$msg=$_POST['msg'];
mysql_connect("localhost","root");
mysql_select_db("user");
mysql_query("INSERT INTO user (name,pwd,status) VALUES ('$msg','work','0')") or die(mysql_error());
?>
I'd like to know why $.post isn't sending the msg variable correctly
Thanks!