Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form id="login_form">
- Login<br/>
- user: <input id="login_user" name="login_user" type="text" /><br/>
- pass: <input id="login_pass" name="login_pass" type="password" /><br/>
- <input type="button" value="Submit" onclick="doStuff("login")" />
- </form>
- function doStuff(doWhat){
- var sendString = new FormData(document.getElementById("login_form"));
- if(window.XMLHttpRequest){
- xmlhttp = new XMLHttpRequest();
- }else{
- xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
- }
- xmlhttp.open("POST", "?action="+doWhat, true);
- xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
- xmlhttp.onreadystatechange = function(){
- if(this.readyState == 4 && this.status == 200){
- //do stuff
- }
- };
- xmlhttp.send(sendString);
- }
- D:wamp64wwwtestindex.php:18:
- array (size=1)
- '------WebKitFormBoundaryubX9lqZJrSEuJwB9
- Content-Disposition:_form-data;_name' => string '"login_user"
- admin
- ------WebKitFormBoundaryubX9lqZJrSEuJwB9
- Content-Disposition: form-data; name="login_pass"
- swordfish
- ------WebKitFormBoundaryubX9lqZJrSEuJwB9--
- ' (length=173)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement