php - What is the action doing in this html page? -
can body me analysis following html tell me form action doing logined_form?
<form name="logined_form" action="login" method="post" style="display:none;" > <input type="hidden" name="logined" value="true" /> <input type="hidden" name="client_id" value="78a32e4ee9d4242134124" /> <input type="hidden" name="display" value="web" /> </form> <div class="login" id="nologineddiv"> <form name="login_form" action="" method="post" onsubmit="return check_form();"> <ul> <li class="fix"><input name="username" class="u" value="email" type="text" onclick="username_onclick();" onblur="username_onblur();"/> </li> <li class="fix"><input name="password" class="p" type="password" /> </li> <li> </li> <li class="fix"><button>authorize</button> </li> </ul> </form> </div> <script type="text/javascript"> var login_form = null; var logined_form = null; var xmlhttp = null; function init(){ login_form = document.forms["login_form"]; logined_form = document.forms["logined_form"]; } function submitautologin(){ logined_form.submit(); } var check_form = function(){ if(login_form["username"].value == "email"){ login_form["username"].select(); return false; } if(login_form["password"].value == ""){ login_form["password"].select(); return false; } xmlhttp = createhttpobject(); if (xmlhttp) { xmlhttp.open("post", "https://api.mywebsite.com/login.do", true); xmlhttp.onreadystatechange = function(){ if (xmlhttp.readystate == 4) { eval(xmlhttp.responsetext); } }; xmlhttp.setrequestheader("content-type", "application/x-www-form-urlencoded"); var query = "_=_"; query += "&loginname=" + encodeuricomponent(login_form["username"].value); query += "&password=" + encodeuricomponent(login_form["password"].value); query += "&act=ajaxlogin2json"; query += "&app=oauth2"; query += "&callback=login_callback"; xmlhttp.send(query); } return false; }; var login_callback = function(result){ var status = result["system"]; if(status == 0){ showmsg("password wrong"); return ; }else if(status < 0){ showmsg("failed login"); return ; } submitautologin(); }; </script> after login successfully, submitautologin() function called logined_form submit. don't understand action="login" means. can help? thanks
action property mentions exact action taken on form-submission. action property holds value of "script page" further contains logic manipulate data received form.
in code have posted above - action kept empty , on onsubmit event calling javascript function check_form().
check_form() further makes ajax call server-side script , manipulates form values.
Comments
Post a Comment