Forum Moderators: open

Message Too Old, No Replies

Post form data as URL

Looking for a NON JAVASCRIPT solution

         

rocknbil

11:37 pm on Nov 25, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I know this is the JS forum, but thought maybe one of you had an idea.

I know I can do this.


<form action="" onSubmit="return sendURI(this.q.value);">
<input type="text" name="q">
</form>
<script type="text/javascript">
function sendURI(val) {
var uri = '/some-uri/' + val;
document.location=uri;
return false;
}
</script>

Does anyone know a way to do that without Javascript, and without doing a server-side redirect?

- enter "search term" into form
- resulting URI is /some-uri/search-term

Probably not, with a shot . . .

daveVk

12:47 am on Nov 26, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I take it the issue is getting /some-uri/search-term vs /some-uri?q=search-term ?

rocknbil

5:10 am on Nov 26, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well, sort of. :-)

Using the above, I can now get /results/keyword-rich, and the pages are unique. But of course, JS isn't executed by S.E.'s.

So I'm introducing links to these areas

/results/some-keyword
/results/some-other-keyword

which gives something to the S.E.'s. The form still works without JS, but you get either an ugly query string with get, or the same URL for all searches with post.

It's a stupid question, I know, and probably know the answer, but hoping someone has an idea.

daveVk

1:57 am on Nov 27, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Go ugly.

JS isn't executed by S.E.'s.

True, but JS or not the S.E.'s are not going to submit the form data.

So I'm introducing links to these areas
/results/some-keyword
/results/some-other-keyword

Ugly links would arguably work as well here
/results?q=some-keyword
/results?q=some-other-keyword

Indeed replacing 'q' with something specific like brand=... may be a plus.

Look at what you consider ugly in the get request, and turn it into semantic gold for the S.E's ?