PDA

View Full Version : JSON + IE failure



SchattenMann
5 Aug 2009, 6:36 AM
hello there

for the past hours i've been fighting against one stupid bug or whatsoever...

i have



Ext.Ajax.request({
url : 'php/menu.php',
method: 'POST',
params :{cmd:'checkModule'},
success: function ( result, request ) {

var jsonData = Ext.util.JSON.decode(result.responseText);

...in here i build my menu based on the request...

}
});


the result is exactly this:



[
{
name: 'Processos',
order: '1',
icon: 'icon-processos',
iconLarge: 'icon-processos-large',
cmd: 'processos'
},{
name: 'Estatisticas',
order: '2',
icon: 'icon-estatisticas',
iconLarge: 'icon-estatisticas-large',
cmd: 'estatisticas'
}
]


in FF and Chrome i have no problems at all...

with IE8 nothing happens...

now the funny part...if i just press F12 and leave the window open...

hell it all works!now if i close it...bye bye O.o

any idea? i mean i know its stupid yah...but its true

11 Aug 2009, 4:34 AM
strange. Try using "callback" instead of "success". does that work?

SchattenMann
11 Aug 2009, 7:30 AM
i do think i found the problem - but not the solution

the first included js file i have is the one that makes this request...so the data is retrieved before almost every code gets in (and thats just what i want) and its saved as a dom attribute

now the last thing done, after the viewport gets rendered is to get that attributes and add some menu items...

with a lot of digg i'm sure that IE8 doesn't respect this order and, if i don't have that programmer popup open the request is only executed last with the onReady() stuff no matter what i do...

i don't have a clue on why but it's true...:-?

11 Aug 2009, 7:37 AM
if you're using IE8, step through your code with the debugger!

SchattenMann
11 Aug 2009, 8:00 AM
thats exactly what i did and that's how i know ...but the reason why is a mystery for me.