Answer the question
In order to leave comments, you need to log in
Problem with redirect to Node.js Express JavaScript kiwi payment form?
Hello, here is such a problem, when you click the button, you need to redirect a person to the qiwi payment form (it seems to be created normally), such an error appears in the console.
Here is the code that I have in the main server script
app.get('/create-payment', function (req, res) {
res.redirect(qiwi());
})
Qiwi is a payment form creation function document.querySelectorAll('.payments').forEach(function(element){
element.onclick = createPayment;
});
function createPayment() {
fetch('/create-payment',
{
method: 'GET'
}
).then(function (response) {
return response.text();
}
)
}
Answer the question
In order to leave comments, you need to log in
1 Error - https://expressjs.com/en/resources/middleware/cors.html . Documentation to help.
2 Error - You are redirecting to an AJAX request, not to the user's browser page.
Send a link to the redirect to him in json, for example.
When the answer comes, do a redirect from the browser.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question