I have an input box with a 'did you mean' box that pops up under it, and it pulls it's results from another php page, however when a term with a space in it, such as "I am" vs. "Im" is entered, it stops working. This is the code i'm using to pull the results.
So I made a added a simple string replace to change each space into '+';
search = $('#search').val().replace(' ','+');
search.keyup(function() {
results.load('results.php?q=' + search);
});
But for some reason it is only changing the first space into a '+';
so for example: "Hello how are you" = "Hello+how are you".
but I need it to change to "Hello+how+are+you";
Any suggestions?? Im stumped... :(