I have an AJAX POST that is sending back a successful response from my PHP file newPNRsubmit.php
:
if(isset($_POST['ticketentry'])){
$_SESSION['ticketEntry'] = 1;
header("location: pnr-details?id=".$pnrid);
}
However I would like to use the AJAX response that I am receiving into window.location
This is the response:
XHR finished loading: GET "https://example.com/pnr-details?id=240".
This is my AJAX structure:
$.ajax({
type: "POST",
url: "newPNRsubmit.php",
data: {
bookingdate: bookingdate,
airline_id: airline_id
},
cache: false,
success: function(data, url) {
$('#NewPNRModal').modal( 'hide' );
},
error: function(xhr, status, error) {
console.error(xhr);
}
});
return false;
How can I correctly parse the URL that I am receiving into window.location
?
UPDATE: This is the response from console tab. The second GET XHR
is showing the link I need for window.location
. Should I update the header location to send JSON
data in my PHP
file in order for this to work?