I am able to pass plain text to my api's url as follows:
var bus = $('.location').text();
$.getJSON('http://apiofsite'+bus+'apiofsitecontinued.com'), function(){
do something});
Now I want to be able to do the same thing, but using the input field instead of printed HTML. Something like so:
<input id="stuff" type="input" />
So ideally my JS would be like so.
var sang = $('#stuff').val();
$.getJSON('http://apiofsomewebsite'+sang+'apiofsomewebsitecontinued.com'), function(){
do something});
I don't believe that the URL is reading my input, as it returns empty.
onClick, after the user has entered a term?$(document).on('click', '#somerandomdiv', function(){myproblemhere});after user has entered into#stuffvar sang = $('#stuff').val().replace(/\s+/g, '')to remove spaces and extra characters that should not be in the url.