Parse JSON from URL

后端 未结 3 1737
伪装坚强ぢ
伪装坚强ぢ 2021-02-10 04:46

I am building a web site and I use a url which returns a JSON response, like:

{name:mark; status:ok}

I would like to obtain the name, using onl

3条回答
  •  心在旅途
    2021-02-10 05:18

    $.getJSON("URL", function(json) {
       alert("JSON Data: " + json.name);
     });
    

    I guess this will work for you.

    If you want to Pass parameters then here is code

    $.getJSON("URL", { name: "John", time: "2pm" }, function(json) {
        alert("JSON Data: " + json.name);
        });
    

    Refer link

提交回复
热议问题