My god? I think Im going mad? What the hell is wrong with this code?
log(typeof t);
// This is fine, returns 'string',
// like a good ickle jquery function
$.getJSON("/js/json/jsonsource.js",function(js){
$.each(js.items, function(i, n){
if( n.id == b_idx ){
$.each(n.pricing, function(y, h){
log(typeof t);
// This goes mad?!? Returns 'object'..
// but I didnt change it?
log(h.id == t);
// This fails, I need to compare the value of t,
// to a parameter here, but it wont let me cos
// they are different datatypes..
});
}
});
});
I've commented the code to show you whats going on.. Firebug spits out "string" for the first typeof, and "object" for the second, but I never cast it?
Any ideas? By the way, there's nothing wrong with any of the json retrieval, the only thing that fails is the comparison.