0

I have an a tag that has href="/test". This sends me to my routes page and goes to a controller and everything works. What I am wondering is if there is a way to attach a variable to /test that is from a html input tag the user inserted data into. For example I will have an input

<input type="text" class="form-control" name="number" id="number" placeholder="e.g. 1">

and I want my href to be href="/test/" number

Aaron
  • 4,380
  • 19
  • 85
  • 141

1 Answers1

2

Use javascript for this at onsubmit or call any function on button click . And inside function use below code

 var number = 1;// Get value here from text box as $("#number").val();
 location.href ="/test/"+number;
Niklesh Raut
  • 34,013
  • 16
  • 75
  • 109