\' + data[\'result\'] + \' \'); $(\'#input\').val(\'\'); // reset the textbox })
ID: 3833162 • Letter: #
Question
' + data['result'] + '
'); $('#input').val(''); // reset the textbox }) .fail((xhr) => { alert('Problem contacting server'); console.log(xhr); }); }); });
Hello, from Node!!
'); res.render('index', {title: 'NameSurfer'}); }); // Name surfer end point app.get("/namesurfer", (req, res) => { let input = req.query.text; NameSurfer.findOne ({name: input}, (err, rec) => { if (err) { console.log(err); res.json( {result: '***DB ERROR***'} ); } else if (rec == null) { res.json( {result: '***DB ERROR***'} ); } else { res.json( rec ); } }); }); // catch 404 and forward to error handler app.use(function(req, res, next) { let err = new Error('Not Found'); err.status = 404; next(err); }); // error handler app.use(function(err, req, res, next) { // set locals, only providing error in development res.locals.message = err.message; res.locals.error = req.app.get('env') === 'development' ? err : {}; // render the error page res.status(err.status || 500); res.render('error'); }); module.exports = app;
CSV file(data):
Name Surfer Name undefinedExplanation / Answer
' + data['result'] + '
'); $('#input').val(''); // reset the textbox }) .fail((xhr) => { alert('Problem contacting server'); console.log(xhr); }); }); });
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.