When checking the value in the alert, it always shows as 'Initial'. However, the condition if(checkoption == 'Initial')
always returns false.
The actual code is as follows:
function changeItem(id,item,option) {
var xhttp;
xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
if(this.responseText=="Initial"){
$("#Initial").load("Item-<%=cha_id%>.html #Initial", function()
{
document.getElementById("Initial").style.display = 'block';
document.getElementById("Final").style.display = 'none';
});
}
if(this.responseText=="Final"){
$("#Final").load("Item-<%=cha_id%>.html #Final", function()
{
document.getElementById("Initial").style.display = 'none';
document.getElementById("Final").style.display = 'block';
});
}
}
};
xhttp.open("GET", "<%=landingpage_basepath %>/ChangeItemValue111?info="+id+"&item="+item+"&option="+option, true);
xhttp.send();
}
}