zoukankan      html  css  js  c++  java
  • jquery19 ajax()

    <!DOCTYPE HTML>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>ϞҪ͢τյ</title>
    <script src="jquery-203.js"></script>
    
    </head>
    <body>
    <script>
    window.onload = function(){
    
    $.param({'aa':1,'bbb':2});//aa=1&&bb=2
    $.param({'aa':汉字,'bbb':2});//aa=编码&&bb=2
    $.param({'aa':[1,3],'bbb':2},);
    $.param( [ {'name':1,'value':2} ] );//1=2,name为key,value为value
    $.param( [ {'name':1,'value':2},{'name':3,'value':4} ] );//1=2,name为key,value为value
    var $a = $(  [ {'name':1,'value':2},{'name':3,'value':4} ] )
    };    
    console.log( $.param($a) )
    </script>
    </head>
    
    <body>
    
    <div id="div1" style="MozTranfroms" width="100px" text-align="left">aaaaaaaaaaaa</div>
    
    </body>
    </html>
    <!DOCTYPE HTML>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>sss</title>
    <script src="jquery-203.js"></script>
    </head>
    <body>
    <script>
    window.onload = function(){
        console.log($('#form1').serialize());//a=1&b=2
        console.log($('#form1').serializeArray());//[{'name':'a','value':'1'},{'name':'b','value':'2'}]
        $('#form1').get(0).elements;//表单所有属性,只有表单有elements属性。elements属性是原生js对象才有的属性。
        
        
        $('#div1').load('1.html');//div里面加载1.html页面,
        $('#div1').load('1.html ol',function(a,b,c){
            console.log(a);//返回的页面
            console.log(b);//success
            console.log(c);//xml response对象
            alert("加载完成");
        });//div里面加载1.html页面里面的ol标签,完成后回调
        $('#div1').load("1.html ol,{'name':'hello'}",function(a,b,c){
            console.log(a);//返回的页面
            console.log(b);//success
            console.log(c);//xml response对象
            alert("加载完成");
        });//div里面加载1.html页面里面的ol标签,完成后回调
    
        
        $.ajax({
            url:url,
            success : function(){}
            error:
        }).done(function(){}).fail(function(){});
        
        
        $.get('url',{'aa':123},function(){'成功回调'},'返回数据类型xml、json')
        
        
        $.getScript( 'url',function(){} )
        
        $.getJSON( 'url',function(){} )
        
        
        $.ajax({
            type:'post',//默认get
            url:url,
            cache:false,  //请求后面加一个时间戳,不会有缓存
            success : function(){}
            error:function(){}
        });
        
        
        $.ajax('url',{
            type:'post',//默认get
            success : function(){}
            error:function(){}
        });
        
        $.ajax({
            url:url,
            timeout:1000,   //一秒钟没有请求成功就报错
            type:'post',
            success : function(){alert(1)},
            error:function(){alert(2)},
            statusCode:{
                404:function(){
                    alert();
                }
            }
        });
    }
    </script>
    </head>
    
    <body>
    
    <form id="form1">
        <input name="a" value="1">
        <input name="b" value="2">
        <input type="submit">
    </form>
    
    <div id="div1"></div>
    </body>
    </html>
  • 相关阅读:
    常用的ORM框架与自动化映射工具
    数据持久化
    char、nchar、varchar、nvarchar 的区别
    MS SqlServer还原数据库,出现媒体簇的结构不正确
    根据字段查询所有表名
    java中package指什么
    MybatisGenerator生成的mapper 少了识别主键的方法 byPrimaryKey()
    Sql Server触发器的使用
    WebService生成XML文档时出错。不应是类型XXXX。使用XmlInclude或SoapInclude属性静态指定非已知的类型。
    sqlserver记录去重
  • 原文地址:https://www.cnblogs.com/yaowen/p/6951182.html
Copyright © 2011-2022 走看看