I have a value stored as thekeyvalue. In this case "12F" for example. I want to see if it exists in my JSON. If so, I'd like to grab the PNG value. If not, just send a message back
JSON
{
"Property": "99",
"12F": {
"png": "12-74"
},
"13F": {
"png": "12-74"
}
}
JQUERY
var sourceurl = '../floorplan-data.json';
var thekeyvalue = $("#finalkey").text();
//start ajax request
$.ajax({
url: sourceurl,
//force to handle it as text
dataType: "text",
error:
function(){
//error
},
success: function(data) {
var json = $.parseJSON(data);
console.log(json.thekeyvalue); //having trouble here
}
});