If Then Statement not working within a success function.
Hey All,
Just wondering if someone could tell me why my page is not redirecting within the if then statement, here is the code.
function addComplaint()
{
var datastr = $("#h3sForm").serialize();
$.ajax({
type: "POST",url: "
http://oscscar02/functions/addComplaint.php", dataType: "html",
data: datastr,
success: function(html)
{
top.alert('Complaint Form Added');
$('input[name=subBut]').attr('disabled', 'disabled');
if($("#warranty").is(':checked'))
{
top.location.href = 'http://oscscar02/index.php';
}
},
error: function(XMLHttpRequest, textStatus, errorThrown)
{
alert("JQuery ajax error: " + textStatus);
}
});
}
I have tried this without the if then statement and it works fine. I am not sure why my if then statement will not work within success function, am I doing something wrong?