My API works and the structure in the response is below.
There is one client and client has multiple headers and each header has one Name and URL and so on.
THeader1
- TReports
- Name
- URL
THeader 2
-TReports
-Name
- URL
But I want to push it to be array object where I can use it like below:
myVizes = new Array(
{
'name' : 'Test1',
'url' : 'https://test/views/test/Alert?',
'hash' : 'test'
},
{
'name' : 'Test2',
'url' : 'https://blahblah/views/blah/Alert?',
'hash' : 'Test2'
},
{
'name' : 'Test2e',
'url' : 'https://test/views/test?',
'hash' : 'Test'
}
);
However, my jSon
getURLS: function (ID)
{
var data = {};
if (typeof (_config.clientID) != 'undefined') {
data.clientID = _config.clientID;
}
var outputdata = '';
$.ajax({
type: 'POST',
url: _config.GetHeadersByClientAPI,
dataType: 'json',
contentType: 'application/json',
data: JSON.stringify({TReports:data}),
success: function (data)
{
alert("it works!"+data)
},
error: function (xhr, status, error)
{
alert("did not work!")
}
});
}
My data returns emjpty object. Any thoughts?