• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 5063
  • Last Modified:

Help reading parameter values from a form POST using javascript

Is there a way, using javascript, to read paramete values from a form POST? I have a function that pulls parameter values from a form GET e.g...

function getTheParam(wut,qp,dflt){ dflt=(dflt==null)?'':dflt; try{r=unescape(wut.match(new RegExp(qp+"=+([^&;]*)"))[1]);}catch(qp){r=dflt;} return r; }

But I can't seem to find anything for reading them from a form POST. Note that this is not a PHP question. Just a basic HTML question

Thanks,
Larry
0
biglarrrr
Asked:
biglarrrr
2 Solutions
 
gjutrasCommented:
the post variables go in to the request. the server needs to deal with the form variables.  If the page/script that deals with the variables doesn't in some way put them in the page that gets returned to the client, then there is no way for the client side javascript to be able to read them.  You could change the action on the form using javascript and append ?var1=value1&var2=value2
and that way your function above would work, if the action page doesn't redirect to another page.
0
 
SirCroftyCommented:
I don't think there is any real way to read POST variables through convential means. You could possibly look at transmitting your form through another method - with the XMLHttpRequest object, or by using a hidden frame/new window as an intermediary. You could use the XMLHttpRequest to generate a response from the server, if you need to do some form processing you could have the page returned to you (or an output page to redirect to - you could post variables back to the server after processing?). A frame or window would let you store the form variables somewhere while you redirected the page after processing. I'm not sure what you had in mind, so it depends on what you have available to you.
0
 
biglarrrrAuthor Commented:
Thank you gjutras and SirCrofty. I appreciate the help. I think we're just going to change the process flow for this.

Thanks,
Larry
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now