Skip to content Skip to sidebar Skip to footer

Unable Make A Rest Call

hi all i want to make a rest call and redirect the output to a text area in HTML i am attaching the code please correct my mistake if any and please explain how to attach the outpu

Solution 1:

Don't make it complicated unnecesarily.

 $(document).ready(function () {
   $.ajax({
     url: "http://127.0.0.1:8300/pods",
     method: "GET",
     contentType: "application/json",
     dataType: "json",
     success: function(data){
       // But you mentioned that returned data type is JSON, make sure to parse it.
            $("#podar").html(data);
     },
     error: function () {
       console.log("Failed node Data");
     }

   });
 });

But you mentioned that returned data type is JSON, make sure to parse it or remove dataType:json.

Post a Comment for "Unable Make A Rest Call"