javascript - .load() is not working - jQuery -


i have code this:

$('#message').load('conversation.php?link=projects/living room/room'); 

when run code, says "syntax error, unrecognised expression" in error console in chrome.

but if run same code this:

$('#message').load('conversation.php?link=projects/livingroom/room'); 

this work fine. differece between these 2 lines is, in first 1 there space in work (living room) , in second line there no space in word (livingroom).

what happening here. why .load() displays error when put space , no error no space?

if , @matt ball points out in comments above, $.load() has special interpretation url not need, recommend replacing $.load() better suits requirements. in case, $.get() includes proper callback more appropriate needs.

in case, clear part of problem url including spaces.

but part of url including spaces in data parameters, better consistency , reliability ought supplied parameters jquery functions instead of trying construct url parameters yourself.

$.get('conversation.php',    {link: 'projects/living room/room'},     function(data){ $('#message').html(data) }  ); 

Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -