Saturday, 15 June 2013

node.js - Cannot create uri from simple jade form -


I have a simple Z form with 2 fields and I want to get input from these areas and generate a URI. Am my api

My jade form is:

  head body form in html html in doctype html html (method = 'GET', action = '/' + firstName + '/' + last name ). First name: br input (type = 'text', name = 'first name', value = first name) br | Last name: br input (type = 'text', name = 'last name', value = last name) br br input (type = 'submit', value = 'submit')  

I like to get something like I / John / Doe , which I can handle with my API.

Instead of me undefined / undefined? FirstName = John & amp; LastName = Doe

How can I fix this but any thoughts?

I agree with the maze, you can not do this with jade jade server-side templates javascript But what you need is the client-side JavaScript JQuery with which it can look like:

  $ (function () {$ ('form input [type = submit]'). (Function (e) {e.preventDefault (); First name = $ ('form input [name = firstname]'). Val (); lastName = $ ('form input [name = lastName]'). Val ( ); Window.location.href = '/' + first name + '/' + last name;});});  

No comments:

Post a Comment