I need to set/initialize an array exactly to what JSON will look like so I can have an array that I can store old and new and compare if old = new
.
This is what I have:
function refresh()
{
var old_json = new Array();
var old_json["id"] = 0;
$.getJSON('getMessageDetails.php', function (json) {
var new_json["id"] = json[0].id
if (old_json != new_json)
{
$("#msg_id").html(json[0].id);
$("#subject").html(json[0].subject);
$("#unique_code").html(json[0].unique_code);
var old_json = json[0].id;
}
});
}
what I have at the top is not correct.
JSON returns:
["id":1,"subject":"freechat"...etc}]