javascript - Ajax post to php serverside code -
this home work , given ajax javascript code need modify. having trouble figuring out syntax of of code.
here provided code , suppose write php serverside code
function submit_login() { if( document.form.loggedin.checked ) return request = new xmlhttprequest() request.onreadystatechange = respond_login request.open("post", "ajaxcontroller.php", true /* asynchronous? */ ) request.send( "action=login&password=" + postescape( document.form.pwd.value ) + "&username=" + postescape( document.form.user.value )) document.form.pwd.value = "" document.form.user.value = "" }
i confused on how write server side part post. write this:
$action = $_post['"action=login&password="];
however confused how write above line since 2 variable passed through send. think need parse still find line confusing whats happening.
at server side fetch values 3 statements:
$action = $_post['action']; $username = $_post['username']; $password = $_post['password'];
Comments
Post a Comment