[jQuery] Redirect interupts ajax call
I have the below code, and it works, until I put the js redirect in.
Why is this happening? I thought the, function gets called after a
succesful ajax call ... anyway a bit of help would be greatly
appreciated.
$(document).ready(function(){
var url = '/scripts/orders.php';
var returnUrl = '/admin/dashboard';
function finish( message ) {
$("#status").html(message);
$("#status").effect("highlight", {color: "green"}, 1000);
document.location.href = returnUrl;
}
$("#approved").click(function(){
$.get(url, { action: "approved", orderId: $("#orderId").val() },
finish( 'approved' ) );
});
});