I am trying to pass a text by parameter (with whitespaces) to the load function and it seems it doesn’t work.
Currently i am doing this:
var text ="hello world this is an example";
$("#selector").load("http://"+ document.domain + "/myfunction/"+text);
Is there any way to do it?
If i call the function by URL directly, not with jQuery, it works well.
Thanks.
You should encode “text” with encodeURI:
This will ensure that your whitespaces are replaced with url compatible characters, which your browser does internally when you’re directly accessing the url.