Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <input type="text" id="testo">
- <button type="submit" onclick="send()">Invia</button>
- <script type="text/javascript" src="send.js"></script>
- function send(){
- const valore = document.getElementById("testo").value
- post('/send', {valore})
- window.open("/url", "_self", false)
- }
- function post (path, data) {
- return window.fetch(path, {
- method: 'POST',
- headers: {
- 'Accept': 'application/json',
- 'Content-Type': 'application/json'
- },
- body: JSON.stringify(data)
- })
- }
- app.get('/', (req,res)=>{
- res.render('index.ejs')
- })
- app.post('/invio', (req,res)=>{
- valore = req.body.valore
- app.get('/url', (req,res)=>{
- res.render('testo.ejs', {valore: valore})
- })
- })
- <%= valore %>
Add Comment
Please, Sign In to add comment