Advertisement

Umlauts in Ajax dynamic list

Moderators: Calcifer, slothy

Umlauts in Ajax dynamic list

Postby westor » Tue Sep 19, 2006 11:55 am

As I noticed, the script works well in IE, but not in Firefox. I'm from Germany, we are using umlauts and they are not well coded in urls sended by Firefox.
I fixed up the problem, replacing the follwing line in the dynamic list script:
var url = ajax_list_externalFile + '?' + paramToExternalFile + '=1&letters=' + inputObj.value.replace(" ","+");
to
var url = ajax_list_externalFile + '?' + paramToExternalFile + '=1&letters=' + encodeURI(inputObj.value);

Because of encoding, the number of letters may be increased. To have the correct number of letters until the lookup starts, I changed
if(inputObj.value.length<minimumLettersBeforeLookup){
to
if(decodeURI(inputObj.value).length<minimumLettersBeforeLookup){

To have correct lookup-string in php script I used this:
if(isset($_GET['getOrtByLetters']) && isset($_GET['letters'])){
// $letters = preg_replace("/[^a-z0-9 ]/si","",$letters);
$letters = urldecode($_GET['letters']);
...
}

This works fine for me.
Torsten Wesolek
http://www.fitnesswelt.com/
westor
 
Posts: 1
Joined: Tue Sep 19, 2006 11:44 am

Return to General questions regarding AJAX scripts

Who is online

Users browsing this forum: No registered users and 6 guests

cron