take $("#"+id).val() in consideration
var field = document.getElementById( id );
/* ... */
if( field.value != "" )
var jqxhr = $.get( "/user/ajaxtag/tag/" + $("#"+id).val(), function( data ) {
suggestionText = data;
//does something which i thing is non of problem's business
var arr = getListItems( field.value );
if ( field.value.length > 0 ){
createList( arr );
} else {
clearList();
};
// end of non of business
});
when using english in the input box which triggers this piece of code on change, the ajax request is responded successfully, but when using persian like “س” IE sends this
GET /user/ajaxtag/tag/??_=1338567574102 HTTP/1.1\r\n
(i got this information on wireshark) and replaces the utf8 chars with ?, the problem doesn’t occur when i use firefox, only in ie (not a surprise ha?) i have this line in the header
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
in another question on stackoverflow.com it was suggested to change php.ini, but i am on a shared host and dont have access to the file.
i did alert( $( "#" + id ).val() ) and the alerted thing was not ? was the input char.. like س
You need to encode parameter names and values with encodeURIComponent() function.
or to make it RFC3986 compliant you can use this function: