Hi, I would like to ask or request to anybody to create a simple script using ajax to update a status without reloading the page. To give you an idea it's just like facebook's status update. If anyone here would like to share their knowledge then thanks in advance.
Use Jquery for this, it is alot easier. Assumptions: 1.You have a textarea or field with id="updater" 2. You have a button or link with onclick="updatestatus()" What the code does: 1. Jquery code Posts the value of updater to a php page 2. PHP page gets the update and does something then echos 1 3. Jquery code sees the 1 and the declares a success Javascript <head> <script type="text/JavaScript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js"></script> <script type="text/JavaScript"> function updatestatus() { var updatetext = $("#updater").val(); $.post("updatestatus.php", { message: updatetext }, function(data) { if (data == 1) { $("#updater").val(""); $("#updatesuccess").fadeIn("slow").append("<div id=\"noerror\">Your Update Has Been Submitted</div>"); } }); } </script> </head> Code (markup): PHP $msg = $_POST["message"]; if ($msg) { // Do something echo 1; } PHP: