How to get JSON data from the URL (REST API) to UI using jQuery or plain JavaScript?

后端 未结 4 2009
悲哀的现实
悲哀的现实 2021-02-04 08:26

I have a URL \"http://localhost:8888/api/rest/abc\" which will give following json data. I wants to get this data in my UI using Jquery or java script. I\'m trying

4条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-04 09:11

    You can use us jquery function getJson :

    $(function(){
        $.getJSON('/api/rest/abc', function(data) {
            console.log(data);
        });
    });
    

提交回复
热议问题