Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

node.js passing parameter via querystring

node.js passing parameter via querystring

Problem

In a node.js application on the client side I have the following code in the button click event to call the node.js/express method "getProjectDetails" but because of the hash (#) character, Express is giving an error like "Unexpend end of input". So the question is how to escape the hash (#) character in the parameter query string that is passed to the node.js call?

// CLIENT SIDE CALLING CODE IN THE CLICK EVENT OF A BUTTON 
window.location.href = rootURL + 'getProjectDetails?project=ABCD#EFGH BLAH BLAH';

Whereas the below works fine:

window.location.href = rootURL + 'getProjectDetails?project=ABCDEFGH BLAH BLAH';
Problem courtesy of: sskasim

Solution

You need to escape the hash by using %23 for #.

Solution courtesy of: Parker Hutchinson

Discussion

View additional discussion.



This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

node.js passing parameter via querystring

×

Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription

×