Skip to main content

Bug Tracker

Side navigation

#15087 closed bug (notabug)

Opened May 12, 2014 08:19PM UTC

Closed May 12, 2014 08:23PM UTC

Last modified May 12, 2014 08:30PM UTC

Space in URI making JQuery crash

Reported by: jorgee Owned by:
Priority: undecided Milestone: None
Component: ajax Version: 1.11.1
Keywords: ajax, url, white space, space Cc:
Blocked by: Blocking:

If I have a space in the URI, like in the following example:

url = "/directory/buscador.php?q=[Nombre de Cliente|contiene|Gabriel|DESC]&p=1&v=lista"

function loadXMLDoc(url, div) {


// $('#'+div).load(url.replace(/ /g,'%20'));


Gives an error after the ajax call:


200 OK


jquery-1.11.1.js (line 9631)


200 OK


jquery-1.11.1.js (line 9631)

Error: Syntax error, unrecognized expression: de Cliente|contiene|Gabriel|DESC]&p=1&v=lista

throw new Error( "Syntax error, unrecognized expression: " + msg );

jquery-1.11.1.js (line 1473)

Attachments (0)
Change History (3)

Changed May 12, 2014 08:22PM UTC by jorgee comment:1

The function is

function loadXMLDoc(url, div) {



The $('#'+div).load(url.replace(/ /g,'%20')); is a workaround I made.

Changed May 12, 2014 08:23PM UTC by dmethvin comment:2

resolution: → notabug
status: newclosed

Please ask for help on StackOverflow or

Changed May 12, 2014 08:30PM UTC by jorgee comment:3

Replying to [comment:2 dmethvin]:

Please ask for help on StackOverflow or

You are right, because after space JQuery expects a selector. The bad thing is that there is no way to tell jquery that it is a full uri.