Deden Bangkit Deden Bangkit - 1 year ago 116
Javascript Question

Parse Json from API to Javascript

I have attached API on my javascript which has this result when I posted via postman:

{"result": {
"clientId": 1,
"session": "yJZdWRhIjoiSEExMDA4MzAyMCJ9.wrBz8JpNqMZlqv8Pz2Tx1x-XYecfdsH2B5uTbNPfiQE",
"client name": Andrew,
"address": [
["1","Bandung","West Java","Indonesia"],
["2","Depok","West Java","Indonesia"]

and here's the API script:

var content='';
type: "POST",
success: function (data) {
_Client = data;


How do I push the content of json data to fill this empty var?

var address = ?????
var client_name = ?????

Answer Source
         type: 'POST',
         dataType: 'json', // don't forget !!!
         success: function(data) {
                      var address = data.result.address;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download