mardi 5 juillet 2016

Form data in URL as parameter

I have a simple search form with a single input box. I want the input value to appear in the route URL as a parameter, like:

http://ift.tt/29gCgAF}

An example might be:

http://ift.tt/28O1dmT

I also want the route to have an optional value at the end:

http://ift.tt/29gCo3e?}

How can I have the form data be transferred to the route parameter?

Here's the form (nothing special):

<form action="" method="GET">
    <input class="form-control" name="query" type="text" placeholder="Search">
    <button type="submit" class="btn btn-link">Submit</button>
</form>

I can also use jQuery/Ajax if that helps.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire