0

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... :(

Edited by deraad: n/a

2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by deraad
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.