简体   繁体   中英

Submit GET form in the url instead in the paramaters

I have a get method form which goes to

mysite.com/?p=search&q=QUERY

but I want to let the form send me to

mysite.com/search/QUERY.

I have rewritten URL turned on in .htaccess.

Any help? How do I do this?

Just remove the names of all these elements inside the form and take the values with js or jquery and set them to action attribute like

 $('#formid).attr('action','/url/search/'+query);

You would do this in onsubmit event and return true so that form gets submitted.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM