Answer the question
In order to leave comments, you need to log in
How to pass a value through a form to a script?
I have a script:
const store = require('app-store-scraper');
store.search({
term: 'ninja',
num: 1,
page: 1,
country : 'us',
lang: 'lang'
})
.then(response => {
fs.writeFileSync('file.json', JSON.stringify(response));
})
.catch(err => {
fs.writeFileSync('file.json', JSON.stringify(err));
});
term: 'ninja',
term: ' значение из формы'
Answer the question
In order to leave comments, you need to log in
we hang an event on an input or a button.
we listen to the event and when it happened, we transfer the data from the intup to where we need it.
conditionally in jquery something like this
$(document).on('click', '#btn', function(e) {
store.search({
term: $('#input').val(),
num: 1,
page: 1,
country : 'us',
lang: 'lang'
})
.then(response => {
fs.writeFileSync('file.json', JSON.stringify(response));
})
.catch(err => {
fs.writeFileSync('file.json', JSON.stringify(err));
});
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question