I want to make signup from using php and ajax, can anyone help me with it? I am new to ajax so dont know how to do it. Thanks
I like using jquery for ajax. So you would want to look into using jquery and the .post and .get functions that it offers. Jquery Code Example: What you see here is when the button that has an id="logmein" is clicked it sends the textboxes with the ids of password and user to user_login.php. Then it requests a response and expects JSON to come back. If the php echos success=1 then the login is good and you can send them to the main page with their session information. $("#logmein").click(function(){ $.post("user_login.php", { user: $("#user").val(), password: $("#password").val() },function(data){ if (data.success == 1){ location.href= "user_index.php?user="+data.user+"&session="+data.session; } },"json"); }); Code (markup): In you php you would take the username and password posts and compare them to your database and then output your data in json format. Example: $jsonoutput = array('user'=>$user,'session'=>$session,'success'=>1); echo json_encode($jsonoutput ); PHP: Hope this helps
I agree, use a pre-developed library if you want the easiest Ajax entry point. Personally, I like prototype, but jquery, and mootools are also great libraries.
Learning jquery or mootools is definately the best way. I learned ajax the hard way, and libraries cut development time in half.
When I started learning aJax XAJAX php library was the easiest way to get started, it's pretty easy to use and does everything you will need. Just read the tutorial on here: http://xajaxproject.org/