1

Effort


I've read this question, but I still think there has to be a way to do this client side.

Case


I'm submitting a form that has a few inputs. When the form is submitted, the primary key of those inputs is shown on a results page along w/ other data and a different form.

The effect I'm trying to do is if the input-pk is modified, I want it to reload the page (think window.location.reload()), only I want to update that PK parameter's value with the changed value.

window.location.reload takes one of two values (true/false), which distinguishes if it should use browser cache or not. Thus, it seems like it should be accessible, especially since the Firebug::Net plugin shows the param in the HTTP Header.

The form requires 'Post' submissions, which adds a little more complexity.

Alternative


The other thing I've considered is to store the values in a cookie right before submission, which I can retrieve on the next page and then submit another Post; however I'd like to refrain from exposing the data in Cookies.

Community
  • 1
  • 1
vol7ron
  • 40,809
  • 21
  • 119
  • 172
  • AFAIK, Javascript does not have access to the POST body. Can't think of an API call for that! – Ruan Mendes Jun 07 '11 at 23:48
  • I was hoping that Firefox had some added features and figured I could use some sort of ActiveX in IE. Oh well, cookies it is. Make your comment an answer and I'll give you credit. – vol7ron Jun 08 '11 at 05:59

1 Answers1

1

AFAIK, Javascript does not have access to the POST body. Can't think of an API call for that! If you are using php/.net/ruby, you can encode the POST body as JSON that your JS can use when it's reloaded, can't you?

Ruan Mendes
  • 90,375
  • 31
  • 153
  • 217
  • I am using Perl, which is the magic duct tape language :) -- that said, issuing a .reload() does not pass changed values, it pulls from the browser cache, which can't be accessed from JavaScript. My guess is that encoding as JSON would be no different then including a hidden input, which JS can access. – vol7ron Jun 08 '11 at 13:39