Skip to content
Advertisement

passing node js variable to html using ajax

I am trying to pass python json results to html ajax from node js.

What I want to make is, take some inputs from the client side, and when a submit button is hit, ajax is sending the variables to Node JS then the /data middleware runs a python script which handles the DB and stores the variables and showing the results.

What I did so far is, I can take inputs from the client side, and send the variables from html to Node JS using ajax, and I can also run the python script and it stores the variables to my DB. I can see the results from the back end side. But I do not know how to send back the results to the ajax client side.

Below is my part of back end side Node JS code.

JavaScript

When I use “res.” method, back end side compiler always says “TypeError: res.send is not a function”

Below is my part of java script

JavaScript

Below is my part of html file in case that needed.

JavaScript

Advertisement

Answer

try changing arguments in python results callback:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement