![]() |
Prototype and URL encodeded strings
Sorry if this is in the wrong place but i think the root of the problem lies in the JS part.
I will try to explain in the easiest way my problem. First, i´m using the latest Prototype JS framework (1.6.0.2). I´m having no problem getting it to work except for the darn URL encode bit. And just to avoid any confusion about 'Kat' in the code. I´m using that word because in swedish 'Cathegorys' would be 'Kateogorier'. Now my very simple JS code to accomplish a AJAX GET call is: Code:
function MyLinkKat(MyUrl, MyKat)What do you think ? I´m calling this code like this: Code:
<A HREF="javascript:MyLinkKat('ajax_links.php', 'Bloggs & Misc')">Bloggs & Misc</A>Now i thought to myself, this is easy to fix. So i tryed this aproach: Code:
<A HREF="javascript:MyLinkKat('ajax_links.php', '<?PHP echo(urlencode("Bloggs & Misc")); ?>')">Bloggs & Misc</A>For the sake of argument let´s say that the following code is in the receiving script: PHP Code:
Do you have any suggestions or ideas to what i could change to make this work, or do you want any other information to help me resolve this mather don´t hesitate to ask. It might be a simple solution that i haven't thought about in my frustration. Hope you get what i´m getting at. It´s kinda late and think i´m gonna give this a break for tonight. Cheers :) ----------------------------------------- Update: Well i had some sleep and came up with this temporary solution that works for me. Im using the following PHP functions that i came up with to do some "Ajax Encoding" and "Ajax Decoding" as i like to call it. Wich means i simply replace some chars like 'spaces' and '&' signs with other safe chars that wont 'get lost' in the transport. i made a Encode and Decode function. Here it is: PHP Code:
Cheers again :) |
| All times are GMT. The time now is 08:34 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0