How to split the json values from server side via asp.net and jquery?
The json values I am getting are as follows:
[{"JobTitle":"Asp.Net","Name": Alex"},{"JobTitle":"PHP","Name": Arun"}]
I want to split the above and obtain the datas as Asp.Net,Alex,PHP,Arun.
function getData() {
var $tbl = $('#tblJobInfo');
$.ajax({
url: 'GridScore.aspx/JobData',
type: 'POST',
contentType: "application/json; charset=utf-8",
data: "{}",
datatype: 'json',
async: true,
cache: false,
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert("Request: " + XMLHttpRequest.toString() + "\n\nStatus: " + textStatus + "\n\nError: " + errorThrown);
},
success: function (data) {
debugger;
//alert(data.d);
//alert(data.length);
$tbl.empty();
$tbl.append('
Job Title | Published Date | Expiry Date | Job Status |
---|
');
var rows = [];
//for (var i = 0; i < data.length; i++) {
//rows.push('
' + data[i].JobTitle + ' | ' + data[i].PublishedDate + ' | ' + data[i].ExpiryDate + ' | ' + data[i].JobStatus + ' |
');
rows.push('
' + "Asp.Net" + ' | ' + "06/11/2014" + ' | ' + "06/11/2014" + ' | ' + "Approved" + ' |
');
//alert(rows);
// }
$tbl.append(rows.join(''));
}
});