pee2pee pee2pee - 1 year ago 140
reST (reStructuredText) Question

jQuery - Submit Form to RESTful URL

My mind has gone 100% blank on this so need some guidance please.

<form action="/" id="searchForm">
<input type="text" name="s" placeholder="Search...">
<input type="submit" value="Search">

I need that form so the page redirects to a URL such as{value of search}/
if I searched for

Do I even need jQuery for this?

Answer Source

Solution with jquery:

$('#searchForm').on('submit', function(event){
    $('[name=s]').prop('disabled', true)
    $(this).attr('action', '' +     $('[name=s]').val());

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download