加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Ajax学习-XMLHttpRequest创建,请…

发布时间:2020-12-16 00:39:32 所属栏目:百科 来源:网络整理
导读:在创建XMLHttpRequest中的时候, 不同浏览器有不同创建方法 01 $ ( document ). ready function () { 02 'input#login_button' click ( 03 04 // alert("click"); 05 var username = 'input#username' val (); 06 password 'input#password' 07 if ( == '' )
在创建XMLHttpRequest中的时候, 不同浏览器有不同创建方法

01 $ ( document ). ready function () {
02 'input#login_button' click (
03 04 // alert("click");
05 var username = 'input#username' val ();
06 password 'input#password' 07 if ( == '' ) 08 alert "username can't be empty !" );
09 return ;
10 }
11 12 "password can't be empty !" 13 14 15 password . length <</span>6||password.length>16){
16 alert("password's length must be in 6 and 16!");
17
return;
18 }
19varxmlhttp;
20if(windowXMLHttpRequest 21=new();
22}else 23ActiveXObject"Microsoft.XMLHTTP" 24 25url"username="+username"&password="password 26// alert(url);
27xmlhttpopen"POST","login_result.php"true 28setRequestHeader"Content-type""application/x-www-form-urlencoded" 29onreadystatechangefunction() 30readyState==4&&status200 31 InforesponseText 32"true" 33 locationhref"index.php" 34 35 36 37 38 39send 40 41 );
42});

这是一个实例 =- = 简单明了~

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读