On posting to server: i got jsonp({"code":"680","country":"UK","status":"Citizen"}); i.e the content of result and am trying to access the value of country.
My attempt was creating my own jsonp function to access it.
done(function (result, status, xhr){
console.log(result);
//log result is:
//jsonp({"code":"680","country":"UK","status":"Citizen"});
transfer(result);
})
//outside of jquery call; i have this outside the click function.
function transfer(result){
var xyz = result;
function jsonp(xyz){
alert(xyz.country);
}
}
I don`t get to access the county in jquery done function.; In a nuetral script this works i.e creating and html file for testing.
<script>
var result = jsonp({"code":"680","country":"UK","status":"Citizen"});
jsonp(result){
alert(result.country); // alert is UK
console.log(result.country); //result is UK.
}
</script>
Thank you.