zoukankan      html  css  js  c++  java
  • jquery ajax

    function submitForm(){
    			var submitUrl = url;
    			$.ajax({
    				type: "POST",
    				url: submitUrl,
    				data: {
    					"loginUser.user_name": $("#UserName").val()
    				  , "user.password": $("#password").val()
    				  , "randCode": $("#randCode").val()
    				},
    				beforeSend: function( xhr ) {
    					try{
    						xhr.setRequestHeader('X-Requested-With', {toString: function(){ return ''; }});
    						xhr.setRequestHeader('Cache-Control', 'max-age=0');
    						xhr.setRequestHeader('Accept', 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8');
    					}catch(e){};
    				},
    				timeout: 30000,
    				//cache: false,
    				//async: false,
    				success: function(msg){
    					//密码输入错误
    					//您的用户已经被锁定
    					if ( msg.indexOf('请输入正确的验证码') > -1 ) {
    						alert('请输入正确的验证码!');
    					} else if ( msg.indexOf('当前访问用户过多') > -1 ){
    						reLogin();
    					} else if( msg.match(/var\s+isLogin\s*=\s*true/i) ) {
    						notify('登录成功,开始查询车票吧!');
    						window.location.replace( queryurl );
    					} else {
    						msg = msg.match(/var\s+message\s*=\s*"([^"]*)/);
    						if( msg && msg[1] ) {
    							alert( msg && msg[1] );
    						} else {
    							reLogin();
    						}
    					}
    				},
    				error: function(msg){
    					reLogin();
    				}
    			});
    		}
    

      

  • 相关阅读:
    python-多任务-进程
    注解_Annotation
    ZIP压缩输入/输出流
    什么是API,这篇文章让你豁然开朗
    异常处理(在控制台输入数据)
    控件监听与面板监听
    多态与继承
    Java——socketser与cli
    20170307
    20180305
  • 原文地址:https://www.cnblogs.com/bugY/p/2489224.html
Copyright © 2011-2022 走看看