Hello, using RESTful API a temporary token is returned and logged with console.log(xmlHttp.responseText); . Does anyone know how to then pass that temporary token to the 'Authorization': '{Authoriz...
Are you getting any errors in console? I think there should be an error for line 78 saying 'ticket' is undefined. I'm really tired today so I may miss something obvious here.
I think I see now, those things still needed to be done though. I believe it is a scope issue for line 71. That variable is scoped to that function and is not a global variable. Once outside of that function the variable does not exist.
You could go about this multiple ways. You could attach the variable to the window object, which turns it global but is kind of dirty. Or you could declare your variable outside of your function and then use it in the function at a local level in a certain way that will affect the global variable.
If you declare it in your code like this in the same code block but outside of the function:
var ticket = ''
Then in your function change line 71 to be this without the var at the beginning:
ticket = JSON.parse(xmlHttp.responseText);
That should cause ticket in the function to update the global variable. If it does not, we can try attaching ticket to the window object.