javascript - How do I get GET and POST data from server to client in Meteor -


i building meteor app needs able access request data , take action accordingly. goal able get/post data on both server side , client side. have far:

the code have above works on server, not on client. suggestions? thanks!

update clarity (9/5/13)

if start meteor app, open browser @ http://localhost:3000/?foo=bar, want able access foo on server , on client using same api.

if (meteor.isserver) {     var foo = requestdata.get('foo');     console.log(foo); }  if (meteor.isclient) {     var foo = requestdata.get('foo');     console.log(foo); } 

does have ideas how can accomplish this, whether it's modifying code have, or starting over? thanks!

update on progress (9/5/13)

thanks @denis suggesting use window.location.search read data on client. took so answer , adopted it fit needs this meteor package. request-data.js file posted above has been updated.

now if can find clean way post data available on client. suggestions!


Comments