var data = "needactivation:9";
if (data.indexOf(":") == true) {
replyData = data.split(":");
if (replyData[0] == "needactivation") {
alert("User Id Is " + replyData[1]);
}
}
else if (data == "success") {
window.location.href = "/";
}
else {
alert("Unknown error.");
}
Is my JavaScript. It should alert the User ID but it gives a unknown Error. Any idea whats wrong with this script?
Not sure if this part matters, but i’m using the latest jQuery on the page also.
indexOfreturns an index (or-1if not found), not a boolean. Change this:To this:
Alternatively, you could
splitregardless and then checkreplyData.length.