API Result JS
-
I am using the “API XML/JSON Request” and receiving a response in json with a custom URL in the variable named postLoginPage from the response to then redirect a user to that URL?
The response received in the console is as follows:
{“d”:{“id”:”43″,”type”:”customer.type.individual”,”name”:”TEST CUSTOMER”,”sessionId”:”0fdb411ad7ec5a64545″,”postLoginPage”:”postLogin.html?vbklkIjoiMGZkYjQxMWFk&logout=aHR0cHM2U=“}}I need to extract the postLoginPag and then redirect the user to my base URL + the postLoginPage, e.g. based on the response above it should redirect to “https://testing.com/postLogin.html?vbklkIjoiMGZkYjQxMWFk&logout=aHR0cHM2U=“
And my JS is as follows:
// Redirect the user to the constructed URL
window.location.href = ‘response.d.postLoginPage’;What am I doing wrong?
The topic ‘API Result JS’ is closed to new replies.