SHARE
TWEET

Untitled

a guest Jan 18th, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <input type="text" id="testo">
  2. <button type="submit" onclick="send()">Invia</button>
  3. <script type="text/javascript" src="send.js"></script>
  4.    
  5. function send(){
  6. const valore = document.getElementById("testo").value
  7. post('/send', {valore})
  8. window.open("/url", "_self", false)
  9. }
  10.  
  11. function post (path, data) {
  12.     return window.fetch(path, {
  13.       method: 'POST',
  14.       headers: {
  15.         'Accept': 'application/json',
  16.         'Content-Type': 'application/json'
  17.       },
  18.       body: JSON.stringify(data)
  19.     })
  20.   }
  21.    
  22. app.get('/', (req,res)=>{
  23. res.render('index.ejs')
  24. })
  25.  
  26. app.post('/invio', (req,res)=>{
  27.     valore = req.body.valore
  28.     app.get('/url', (req,res)=>{
  29.         res.render('testo.ejs', {valore: valore})
  30.     })
  31. })
  32.    
  33. <%= valore %>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top