0

i am working with javascript and using IE 11

I have this function "retornoZoomProduto" that sets a variable with data from the database called RETORNO wich is a global variable;

currently, i need to acess this object in a different function like this: "RETORNO.raw;"

this works fine in google chrome but won't work on IE 11

Here's an example so i can make myself clearer

var RETORNO;

function retornoZoomProduto(retorno){ 
    console.log("retornando");
    console.log(retorno);  /*this works ok*/
    RETORNO = retorno;
}


function showMercado(){
    console.log(RETORNO) 
    /*this returns    [object]{0: <Permission Denied>} */
}

https://jsfiddle.net/dpLeueky/1/

Why does this happen ? and only in IE 11 ?

Douglas Heydt
  • 13
  • 1
  • 8
  • Can you post something with correct syntax that actually shows how you're using these functions? You're missing the `function` keyword before `showMercado`. – Barmar May 18 '15 at 16:18
  • It works fine for me in IE11 using a corrected fiddle: https://jsfiddle.net/barmar/dpLeueky/2/ – Barmar May 18 '15 at 16:20
  • Are there any asynchronous functions involved? See http://stackoverflow.com/questions/23667086/why-is-my-variable-undefined-after-i-modify-it-inside-of-a-function-asynchron?newsletter=1&nlcode=97716%7c4ba7 – Barmar May 18 '15 at 16:21
  • edited the missing keyword, ithe fiddle is just an example to explain what happens – Douglas Heydt May 18 '15 at 16:22
  • The fiddle doesn't explain anything, since it never calls either function. And can't because it has the same syntax error. – Barmar May 18 '15 at 16:23
  • @Barmar in the fiddle you set the value to raw.regiao, but in my code this data is already set on retorno, the strange is that when i console.log it in the first function, it prints the entire object, but soon as i leave the scope of the function it won't work – Douglas Heydt May 18 '15 at 16:27
  • That was just a sample object for the fiddle, since I need to pass something to the first function. You need to provide a [MCVE](http://stackoverflow.com/help/mcve) that actually demonstrates the problem. – Barmar May 18 '15 at 16:30

0 Answers0