Essentially, we have two form fields asking for users to supply us with two alphanumeric strings, and a URL needs to be constructed from the two. However, there is a basic structure to the URL that needs to be kept in place.
Users will input the requested numbers in two text fields on our site, then click a submit button. At that point the input data needs to be inserted into the URL and opened in their browser.
Example: URL.com/FixedData + UserEntry1 + FixedData + UserEntry2 –– UserEntry1 & UserEntry2 will be inserted between the fixed data.
The finished URL would appear as:
You pretty much answered your question.
<input id='UserEntry1' type='text'> <input id='UserEntry2' type='text'>
var URLBase = "http://URL.com/fixeddata1"; var TrailingFixedData = "fixeddata2"; finalURL = URLBase + document.getElementById('UserEntry1').value + TrailingFixedData + document.getElementById('UserEntry2').value;
Or if you're using jQuery:
finalURL = URLBase + $('#UserEntry1').val() + TrailingFixedData + $('#UserEntry2').val();