Reputation: 15484
Im using a very simple 64 bit decoder written in javascript to decode and then to eval the result:
var foo = decode64('eyAiZm9vIjoiYmFyIiB9');
alert(foo);
logUser = eval(foo);
alert(logUser);
The first alert fires, the second not. Im getting an error when trying to eval:
Uncaught SyntaxError: Unexpected token :
I don't get it, the foo var has the correct content as the alert shows, attually if you copy the result from a console.log and write the exact code on the console its executes as it should:
Im thinking it could be related with char encoding...
Please check this FIDDLE
Upvotes: 0
Views: 61
Reputation: 7740
Your foo
variable is currently a string (not a javascript object). You simply need to parse it.
logUser = eval(JSON.parse(foo))
Upvotes: 3