I have made simply chat box application using (Ajax/jQuery, MySQL, PHP). Here is my application: http://userhelio.byethost13.com/Chatvv/index.php . As you can ses (when you highlight the text of message) div tag is refreshed every second.I want to refresh the div tag only when I click on “send message” button (submit button). In other words, when there is an activity on the page.
Thanks
The setInterval() statement in your code is the likely culprit that causes it to be refreshed every second:
Remove that from your one script file and it should stop refreshing all the time. Rather replace it with a click-handler for your button that executes the code-block in the function of the interval.
You can set it as follows (assuming your button has an ID of “buttonID”):
To do an initial load on the page, add the following: