Clearly I'm doing something wrong, but I can't get my head around this one. Wonder if anyone can point me in the right direction?
I have an object class with a property called lastString, which is init'd as follows:-
serverManager.lastString = "";
I have a JAVA applet on a page, which has a function I can call and should return a string to me, which is JSON (for later EVAL):-
var myApplet = document.getElementById('myApplet');
var rjson = myApplet.getTheJSONThing();
The idea of this is an optimisation. If the rjson string is the same as it was last time, I don't need to do anything with it (eg, I'm looking for changes):-
if (rjson != serverManager.lastString) {
updateTheUI();
serverManager.lastString = rjson;
} else {
doNothing();
}
The problem is, rjson never equals serverManager.lastString. They are always different as far as this conditional is concerned, even though when I alert both strings I can quite clearly see they are identical.
Any ideas on why the == is saying they are different, although when I display them they are the same?
Thanks!