ajax 基本使用方法

来源:互联网 发布:httpclient优化高并发 编辑:程序博客网 时间:2024/06/14 13:13

$.ajax({
        type: "post",
        url: loginUrl,
        data: "username=" +uname + "&password=" +pwd,
        async: false,
        dataType: "json", //返回json格式的数据
        cache: false,
        success: function(msg) {
            if (msg != null) {
               alert(msg.script);
               $("#test").html(decodeURIComponent(msg.script));
               
            }
            else {
              
            }
        },
        error: function(msg) {
           alert(msg);
        }
    });

原创粉丝点击