开发者

jquery's ajax method

开发者 https://www.devze.com 2023-04-01 22:00 出处:网络
$.ajax({ type:\"get\", url:\"/test/api/?u=\"+u, dataType:\"json\", data:\"\", success:fun开发者_运维知识库ction result(data){
$.ajax({
    type:"get",
    url:"/test/api/?u="+u,
    dataType:"json",
    data:"",
    success:fun开发者_运维知识库ction result(data){
            $("#show").html(data);
        $("#show").show();
       }
});

i don't understand the above code well, especially the success part. i don't know what will be passed to the parameter data. expect someone can explain it to me. thank you.


data will hold the content returned by the url that you sent the request to. If the url you are posting to is another HTML page, the code for the entire page will be stored in data for example.


In this case data is a javascript object, like a dictionary, list, int, string, etc. because the dataType is json and jQuery auto-convert the response returned by the url to a javascript object.

0

精彩评论

暂无评论...
验证码 换一张
取 消