天天看點

JQuery Ajax 請求格式

Ajax 請求格式

function clickFun() {
    $.ajax({
        url: "http://localhost:8088/user/get-level-users?level=1",
        type: "GET",
        headers: {
            "X-Requested-With": XMLHttpRequest
        },
        success:function(result){
            console.log(result)
        },
        error:function(error){
            console.log("error", error)
        }
    });
}
function postMethodFun(){
    $.ajax({
      url: Feng.ctxPath + "/authentication/approval",
       type: "POST",
       data: JSON.stringify(data),
       contentType:"application/json",
       dataType : "json",
       success:function(result){
           console.log(result)
       },
       error:function(error){
           console.log("error", error)
       }
   });
}      

繼續閱讀