I have this code...
const handleMonitoring = async (noPKK) => {
let body = {
"MonitoringForm[nomor_pkk]": noPKK,
};
const config = {
headers:{
'Content-Type': 'application/x-www-form-urlencoded'
}
}
axios.get( '' , body,
config)
.then( response => {
console.log(response.data, "Monitoring");
})
.catch((err) => {
console.log(err);
});
}
and for response I get, like this... enter image description here
how I can open this "response" HTML in new tab browser...
I have this code...
const handleMonitoring = async (noPKK) => {
let body = {
"MonitoringForm[nomor_pkk]": noPKK,
};
const config = {
headers:{
'Content-Type': 'application/x-www-form-urlencoded'
}
}
axios.get( 'https://monitoring-inaportnet.dephub.go.id' , body,
config)
.then( response => {
console.log(response.data, "Monitoring");
})
.catch((err) => {
console.log(err);
});
}
and for response I get, like this... enter image description here
how I can open this "response" HTML in new tab browser...
Share Improve this question edited Jan 8, 2021 at 6:54 Imran Rafiq Rather 8,1681 gold badge19 silver badges40 bronze badges asked Jan 8, 2021 at 6:47 Dhies_tiraDhies_tira 111 silver badge4 bronze badges1 Answer
Reset to default 3If you want to open a new window with your own HTML, You can use the window.open
method
const handleMonitoring = async (noPKK) => {
let body = {
"MonitoringForm[nomor_pkk]": noPKK,
};
const config = {
headers:{
'Content-Type': 'application/x-www-form-urlencoded'
}
}
axios.get( 'https://monitoring-inaportnet.dephub.go.id' , body,
config)
.then( response => {
let responseHtml = response.data;
console.log(responseHtml, "Monitoring");
//open the new window and write your HTML to it
var myWindow = window.open("", "response", "resizable=yes");
myWindow.document.write(responseHtml);
})
.catch((err) => {
console.log(err);
});
}
Link to the original answer