Ajax redirect on success

The script below works fine, as it successfully uploads the values to the database, but what isnt working is the success bit with the move to the new url. Thats not working at all, and i wondered why as cant work it out and it looks fine to me.

$(document).ready(function(){
$.ajax(
{
crossDomain: true,
contentType: "application/json; charset=utf-8",
url: "https://www.mysite.com/WebService.asmx/TC_LogRequestActivity",
data: {id: "I123", property_ID: '<?php    echo $propertyId; ?>', user_ID: '<?php echo $_SESSION["user"]; ?>', intent: '<?php echo $purpose; ?>' },
dataType: "jsonp",
success:function(){
window.location.href = "index2.php?e=success";
}
});
});

I have tried this too and still not working

$(document).ready(function(){
$.ajax(
{
crossDomain: true,
contentType: "application/json; charset=utf-8",
url: "https://www.cristalhotelcheck.com/WebService.asmx/TC_LogRequestActivity",
data: {id: "IQCrw&nGC9&RGTYuD1hBaoS9S&Nk65!1&C@HD0oqZVODRJW3*BKZLp^58#pQ", property_ID: '<?php echo $propertyId; ?>', user_ID: '<?php echo $_SESSION["user"]; ?>', intent: '<?php echo $purpose; ?>' },
dataType: "jsonp",
}).done(function(){
window.location.href = "index2.php?e=success";
});
});
1 Like

I got it, answer below for others

success: window.location.href = "index2.php?e=success",

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.