Code:
// JavaScript Document
function JNChatroom_Submit() {
var field_a = $("#chatareabox").val();
$.ajax({
type: "POST",
url: "php-script.php?fun=post",
data: "message="+field_a,
success: function(done) {
$("#chatareabox").val('');
}
error: function(e) {
alert("Error: "+e);
}
})
}
For some reason i cant get this code working, it used to work but now it wont i cant find the problem and i have been looking for 2 hours. Please help
This is for a chatroom, after typeing there post they click a button 'onClick="JNChatroom_Submit()" ' but nothing happens, not alert or clearing of the textarea, there is also no submition to my database.
below is my PHP
PHP Code:
if($MySQL){
if($_GET['fun'] == 'post'){
$POST = mysql_query("INSERT INTO chatroom (user_id, post) VALUES ('".$User['id']."', '".$_POST['message']."')");
}
}