I have number of records in a table (oracle). i am using
$json_OutputArray = array();
while ($result = oci_fetch_assoc($parse_submitted_list)) {
$json_OutputArray[] = $result;
}
$jsonstring = (json_encode($json_OutputArray));
echo '{"value":"' . $jsonstring . '"}';
$jsonstring holds keyvalue pair like
{"value":"[{"APPLICATION_NUMBER":"1","FINAL_SUBMISSION_DONE_ONE":"11-SEP-14","EBY_ECODE":"3621","EBY_ECODE_S":"4","SEND_FOR_REVIEW_LEVEL_1_ON":"12-SEP-14","APPLICATION_STATUS_CODE":"1","RESUBMITTED_ON":"12-SEP-14","SEND_FOR_REVIEW_LEVEL_2_ON":null}]"}
I am using ajax to get this value with post method and json datatype
$.ajax({
url: '../PhpProject1/GetValues.php',
dataType: 'json',
type: 'POST',
data: {"fromDate": fromDate, "toDate": toDate},
success: function(response) {
var jsonstring = response.value;
alert(jsonstring);
var obj = JSON.parse(jsonstring);
alert(obj.APPLICATION_NUMBER);
},
error: function(x, e) {
if (x.status === 0) {
alert('You are offline!!\n Please Check Your Network.');
} else if (x.status === 404) {
alert('Requested URL not found.');
} else if (x.status === 500) {
alert('Internel Server Error - Please try after relogin to the application');
} else if (e === 'parsererror') {
alert('Parsing JSON Request failed.');
} else if (e === 'timeout') {
alert('Request Time out.');
} else {
alert('Unknow Error.\n' + x.responseText);
}
}
});
How to decode this json string in javascript by each record.thanks in advance.