Hi i am trying to make code for parse json in jquery and command comes from java controller and i didn't get solution
urlAddCountry="countries/countrylist";
getAjaxCountry(urlAddCountry, CountryDetails, true,true);
function CountryDetails(res)
{
alert(res);
}
function getAjaxCountry(urlAddCountry, func, isToken,isContentHeader)
{
var url=serviceURL + urlAdd;
$.ajax({
url: url,
type: "POST",
//isasync: isAsync,
contentType : "application/json",
beforeSend:function(xhr){
if(isContentHeader){
xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
}
if(isToken){
xhr.setRequestHeader("tokenId",sessionStorage.tokenID);
}
},
success: function(res) {
alert(res);
func(res);
},
error : function(err) {
func(err);
alert("ERROR:STATUS- " + err.status + "; RESPONSETEXT- " + err.responseText + "; STATUSTEXT- " + err.statusText);
//return null;
}
});
}
[{"entry_id":1,"countryName":"India","phoneCode":"91","countryCode":"IN","isBlackListedForPGTran":"0"},{"entry_id":2,"countryName":"Timor-Leste","phoneCode":"NULL","countryCode":"TL","isBlackListedForPGTran":"0"}]
console.log(x)instead ofalert(x).