JQUERY AJAX, Issues with spaces being sent to the server, Why?

Posted by nobosh on Stack Overflow See other posts from Stack Overflow or by nobosh
Published on 2010-03-14T18:20:59Z Indexed on 2010/03/14 21:45 UTC
Read the original article Hit count: 161

Filed under:
|
|
|
|

I'm using the following code to post to the server which is then sent to a MYSQL query to find matches via search.

$.ajax({
url: '/search/spotlight/',
data: "q=" + $(this).val(),
success: function(data) {
}
});

When Q's val has spaces in it, it's creating problems. I'm wondering if I'm handling this correctly? Do I need to encode the value in the AJAX call? Or is this a problem on my backend, which is ColdFusion

Right now JQUERY is posting the following to the server: /search/spotlight/?q=FirstName%20LastName

is this right?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about AJAX