I putted a jQuery script on my chat so the message sends without page refreshing.
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#msgsending").validate({
type: "POST",
debug: false,
submitHandler: function(form) {
// do other stuff for a valid form
$.post('index.php', $("#msgsending").serialize(), function(data) {
});
}
});
});
</script>
And form
<form id="msgsending" name="form" method="post" action="" >
<input name="message" id="message" type="text" maxlength="350" />
<input name="message" id="message" type="text" maxlength="350" />
<input name="submit" type="submit" value="Send!" />
</form>
The code works perfectly. (index is the script that insert the message + username in the database)
But now I have a issue.
The text don't delete on the message input after submitting. I've google'd alot of pages and all the codes didn't work. (Somes worked but message isn't sending)
What do you recommand me?
id=messageon two inputs. jQuery assumes only one element with that id, mening that it only accesses the first.