well the missing "+" sign is in the returned (loaded) html data, not
in the url variables. there are none.

basically i do a

$('#container').load(href);

what gets display in the container is "A magazine" instead of "A+ magazine" .

if in my php script i urlencode($string) the data, then the + sign is
displayed. non sense...



On Sat, Mar 21, 2009 at 1:04 AM, James <james.gp....@gmail.com> wrote:
>
> Could you post how you're doing the .load() jQuery part?
> It sounds like you're passing it through the url, like:
> $.load("page.php"+myVar);
> In this case, you should use some kind of Javascript function to
> encode the variable:
> $.load("page.php?q="+encodeURIComponent(myVar));
>
> Else, it's recommended you should try putting the data in as a
> separate parameter:
> $.load("page.php", {q:myVar});
> the + sign should not be converted. Note that if you do this you're
> POST-ing the data.
>
> On Mar 20, 5:14 am, Alexandre Plennevaux <aplennev...@gmail.com>
> wrote:
>> Hello, i tried that, but htmlentities("A+") echos "A+", so it does not
>> convert it.
>>
>> On Fri, Mar 20, 2009 at 4:06 PM, Martijn Houtman
>>
>> <martijn.hout...@gmail.com> wrote:
>>
>> > On Mar 20, 2009, at 3:59 PM, Alexandre Plennevaux wrote:
>>
>> >> i'm doing an ajax call via the load() function. The fetched string
>> >> contains the "+" sign, and it gets removed in the resulting html. Why
>> >> is that?
>> >> note: i'm using php. The only way i found to have the string shown, is
>> >> to urlencode() it. But i don't want to urlencode() entire texts that
>> >> should remain human-readable.
>> >> I'm sure there is an obvious solution, however i can't seem to find it.
>>
>> > try htmlentities() rather than urlencode() (PHP). I believe the plus sign 
>> > is
>> > interpreted as a space. Please do note that this escapes _all_ HTML code, 
>> > so
>> > it will not be interpreted as HTML (if it contains any).
>>
>> > Regards,
>> > --
>> > Martijn.
>>
>>

Reply via email to