Bug Tracker

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#15087 closed bug (notabug)

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:

GET[Nombre&_=1399925777172 200 OK


jquery-1.11.1.js (line 9631) GET[Nombre&_=1399925777173 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)

Change History (3)

comment:1 Changed 9 years ago by jorgee

The function is

function loadXMLDoc(url, div) {



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

comment:2 Changed 9 years ago by dmethvin

Resolution: notabug
Status: newclosed

Please ask for help on StackOverflow or forum.jquery.com.

comment:3 in reply to:  2 Changed 9 years ago by jorgee

Replying to dmethvin:

Please ask for help on StackOverflow or forum.jquery.com.

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.

Note: See TracTickets for help on using tickets.