Home Ajax案例
Post
Cancel

Ajax案例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
function queryPasswordById(pass_id) {
    var params = {
        pass_id : pass_id
    };
    var param = JSON.stringify(params);
    // 加密
    // var requestJson1 = btoa(encodeURIComponent(param));
    $.ajax({
        url : "password/queryPasswordById",
        type : "post",
        dataType : "json", 
        data : {
            requestJson : param
        },
        async : false,
        success : function(data) {
            // dataType已为json格式,转换报错:missing ] after element list
            // var res = eval("(" + data + ")");
            window.location.href = data; // 跳转,data为后台返回的ModelAndView
        }
    });
}
1
2
3
4
5
6
7
8
$.ajax ({
    type : "get",
    url : "checkFile.do?attachId=" + attachId,
    async:false,
    success: function(data) {
        flag = data;
    }
});
This post is licensed under CC BY 4.0 by the author.