1. I don't think you've provided enough code to help. It would help to see more of the file in which your first line of code appears (data.redirectvalue).
2. The alert you indicate in the screenshot is not the same alert you show code for. Note that the screenshot says "error", but the code you show would alert "failed"
3. You appear to be using a multi-page architecture for the app. I would advise against doing so. Instead you should look into creating a single-page architecture app. Since you're currently using the MPA style, you should indicate filenames alongside your code samples so we have an idea exactly where your code lives.
4. Just a tip: == will coerce types. If you want true equality, use ===. True inequality would be !==.