Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
61 views
in Technique[技术] by (71.8m points)

javascript - I want to send this data {{quote}} to the app.js side

Previously, the value was in an input tag, and I could access it on the app.js page through the name field of the input tag. The type was set to submit. I converted it to a

tag and now can't seem to figure out a way to access it in the app.js side.

The line of code:

<label class = "putItInLine" id="innerContent">Quote:
  <p class = "putItInLine" type="text" name="quoteSelected">
    {{quote}}
  </p>
</label>

The app.js side is here:

const form = req.body;

if (form.userSelectionQuotePage === 'DELETE') {
  // Id would come out as a string, so but in the database,
  // we need it to be as integer, so thats why we've done typecasting
  let id = parseInt(form.id);
  quotes_db.run(`DELETE
                 FROM quotes
                 WHERE quote = ?`, form.quoteSelected,
    function (err) {
      if (!err) {
        res.redirect('/quotes');
      } else {
        console.log('QUOTE NOT DELETED', err);
      }
    });
}
question from:https://stackoverflow.com/questions/65866643/i-want-to-send-this-data-quote-to-the-app-js-side

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...