简体   繁体   中英

JavaScript Display JSON from REST API

First off, I want too say that I have never used JavaScript before so this is new to me. I just want to start playing around with calling APIs from the same webserver and output the resulting JSON in perhaps a textbox? Even the creation of textbox must be handled by the JavaScript. I am using ASP.NET with GET method for the API call.

Can someone please help me get started with this? I just need a little help to get me started in the right direction. Thanks!

Have a look at a JavaScript library called jQuery .

You can do things like:

$.getJSON( "ajax/test.json", function( data ) {
    var $textarea = $("<textarea>");

    $textarea.val(data);

   $("body").append($textarea);
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM