简体   繁体   中英

How do I change URL based on form input?

I'm trying to get some json data based on user input in a form field.

$.getJSON("exampleurl.com/name/FormFieldInputHere")

So in my HTML I have a standard text field and based on what the user writes in the field, I want to replace FormFieldInputHere with that.

Any ideas?

您需要获取表单字段的值并将其附加到您的字符串中

$.getJSON("exampleurl.com/name/" + $('#THEID').val())

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