I want to redirect to a new page after the ajax is complete/success
. That is working fine. But I want to view the response in the new page where I am directing to.
I am not sure if there is any existing way to do it.
function directtoedit(object) {
$('#edit-field-tei-document-und-0-xml').focus();
$('#toolbar-back').show();
clickedTitle = object;
$.ajax({
url: "tabs/get_old_contents.php",
data: {
seltitle: clickedTitle
},
type: 'post',
complete: function(response) {
location.href = "tabs/test.php"
console.log('selectHey' + response.responseText); //Want to view response in test.php
}
});
}
You can save the response
to local storage and retrieve after redirecting.
complete: function(response){
localStorage.setItem('someName', response);
//...
}
Retrieve the response string from storage after redirecting on page 2:
var response = localStorage.getItem('someName');
Browser compatibility for localStorage
Alternatively you can use document.cookie
.