I want to use Ajax/jquery to be able to redirect to another php script to perform a command in the script.
I have a jquery/ajax code function below, my question is that is the jquery.ajax function correct in order to redirect to the “cancelimage.php” script?
$(imageuploadform).find(".imageCancel").on("click", function(event) {
$('.upload_target_image').get(0).contentwindow
$("iframe[name='upload_target_image']").attr("src", "javascript:'<html></html>'");
jQuery.ajax("cancelimage.php");
return stopImageUpload(2);
});
I’m not sure this is what you want , but for a complete redirect
But if your looking for an ajax success/fail type response from your code
Then its a matter of updating your cancelimage.php script to return boolean true/false, a JSON object using json_encode or whatever youd like