JQuery PHP Chatroom

Hi all,

I am working on a PHP Chat Script with multi-room support that also runs off a database anyway im trying to intergrate JQuery to make it more instant anyway

This is my Jquery script

<script type="text/javascript" src="JQuery.js"></script>
	<script type="text/javascript">
			$.post('ChatSend.php', $('#ChatForm').serialize(),function(data)

And this is my html coding

<div id="cwall">
                  <div id="screen">
                      <div id="Loadin"></div>
                   <div id="room">
                          <div id="innerwall"></div>
                  <div id="chat">
                      <form method="post" id="ChatForm" action="">
                        	<input type="hidden" name="user" value="<? echo $user;?>" />
                            <input type="hidden" name="rank" value="<? echo $rank;?>" />
                            <input type="hidden" name="rid" value="<? echo $rid;?>" />
                              <th><input type="text" name="message" /></th>
                              <th><input type="submit" value="Send" /></th>

So my Question is Why isnt the alert poping up any error or showing anything at all so i can see what is going on here if there was an error my alert box would alert me there is an error?

So why is it not showing anything at all?


I Have located the problem this is the line

$.post("ChatSend.php", $("#ChatForm").serialize(), function(data)

What is the problem with that Line??

Hi William,

The problem is actually on your submit handler. You need to prevent the form’s default action (to submit itself), otherwise your ajax request will never be fired.
You just need to modify your code slightly, to look like this:

$("#ChatForm").submit(function(e) {