Answer the question
In order to leave comments, you need to log in
How to pass something to node via ajax?
Good evening!
How to ajax (custom script), pass something to node (express)?
upd : answer
Answer the question
In order to leave comments, you need to log in
form
input(type='submit')
$(document).on 'submit', 'form', ->
$.ajax
type: 'POST'
url: '/send'
data: { test1: 'send', test2: 'send2' }
Node:
bodyParser = require 'body-parser'
app.use bodyParser.urlencoded { extended: false }
app.use bodyParser.json()
app.post '/send', (req, res) ->
console.log 'req.body ', req.body
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question