Been trying for some time now to get the response from my J-SON script to be correctly evaluated so that I in the macro can choose depending on the response to either do stuff on the elements
Have tried several solutions
1 and 3 are when evaluated in the Chrome browser actually ending up with the correct result. But the IF statement keeps going for false...... HELP (not because of missing { or }
Thank you for any help you can give
Problem solved, JSON are running in async mode (sync mode are deprecated)
So to handle the response in a user macro, you need a response function to handled the response like shown below
xmlHttp.onreadystatechange = function (e) {
if (xmlHttp.readyState === 4) {
if (xmlHttp.status === 200) {
if (xmlHttp.response === '{"PageRead":true}') {
document.getElementById('AwareRead').style.display = 'none';
}
else {
document.getElementById('AwareNotRead').style.display = 'none';
}
} else {
console.error(xmlHttp.statusText);
}
}
};
Just had a competent debugger looking at the code and doing some debugging and it appear that xmlHttp.response hasn't been load with any value when the IF evaluation is executed ....
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.