I am developing a cordova mobile application. I consume RESTful web services to fetch JSON data through an AJAX call as below. How do I display the returned JSON data in a bootstrap table with padding?
var datanew = "parameters";
$.ajax({
url: "http://some_url",
async: true,
crossDomain: true,
type: "post",
beforeSend: function(xhr) {
xhr.setRequestHeader("Authorization", "Basic " + btoa('string' + ":" + 'string' ));
},
data: datanew,
dataType: "json",
success: function (data) {
alert("success");
var newDta = JSON.stringify(data);
alert(newDta);
var trHTML = '';
$.each(newDta, function (i, item) {
trHTML += '<tr><td>' + item.employeeId + '</td><td>' + item.empFirstName + '</td><td>' + item.empMiddleName + '</td></tr>';
});
$('#results').append(trHTML);
});
});
The JSON response is in this format.
{ "employeeId ": "00001" }
and
{ "empFirstName ": "techcruize" }
How do I display this data in a bootstrap paginating table? I have tried the above but it's giving undefined values in a table.