jeudi 22 janvier 2015

How do I transfer input from a jade file to my index.js file?

Here is the call in my jade file



extends layout
block content
h1= title

input#input(type="text", result="result") <----------Input called

form(method="post", action="/postquery")
button(type="submit") Search
div
form(method="get", action="/")
button(type="submit") Home


Here is the code I tried to use to call it in "index.js"



router.post('/postquery', function(input, res) {
for (i = 0; i < state.length; i++){
queryResults.push(input);

if (state[i].name == input){
queryResults.push(input);
}

console.log('This is your input: %s',input);


When I print the console log it reads "This is your input: [object Object]"





Aucun commentaire:

Enregistrer un commentaire