phpmady Posted September 6, 2010 Share Posted September 6, 2010 Hi, Using arabic characters, I have a project, in the admin panel, where i am trying to change the value in the text box(ajax) on onblur js function. Firefox simply working great but i am getting square brackets in the text box in the browser ie. I simply guessing the value from the text box is not in the form of utf-8 encoding, i am calling the external javascript file, this is the code am using.. // JavaScript Document var xmlhttp; //function namechange(name_fieldvalue) function namechange(name_fieldvalue,name_fieldname,id_val,id_fieldname,table_name) { /* alert(name_fieldvalue); alert(name_fieldname); alert(id_val); alert(id_fieldname); alert(table_name); */ if (name_fieldvalue.length==0) { document.getElementById("txtHint").innerHTML=""; return; } xmlhttp=GetXmlHttpObject(); if (xmlhttp==null) { alert ("Your browser does not support XMLHTTP!"); return; } var url="ajax_namechange.php"; url=url+"?name_fieldvalue="+name_fieldvalue; url=url+"&name_fieldname="+name_fieldname; url=url+"&id_val="+id_val; url=url+"&id_fieldname="+id_fieldname; url=url+"&table_name="+table_name; xmlhttp.onreadystatechange=stateChanged; xmlhttp.open("GET",url,true); xmlhttp.send(null); } function stateChanged() { if (xmlhttp.readyState==4) { document.getElementById("txtHint").innerHTML=xmlhttp.responseText; } } function GetXmlHttpObject() { if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari return new XMLHttpRequest(); } if (window.ActiveXObject) { // code for IE6, IE5 return new ActiveXObject("Microsoft.XMLHTTP"); } return null; } Anyone has the idea on this, please help me. Thanks, Link to comment https://forums.phpfreaks.com/topic/212635-ajax-calling-not-encoding-in-utf-8ie-problem/ Share on other sites More sharing options...
pengu Posted September 6, 2010 Share Posted September 6, 2010 I think your first step would be to post it in the correct forum. They have a forum dedicated to AJAX questions. Link to comment https://forums.phpfreaks.com/topic/212635-ajax-calling-not-encoding-in-utf-8ie-problem/#findComment-1107723 Share on other sites More sharing options...
phpmady Posted September 6, 2010 Author Share Posted September 6, 2010 Hi, Finally i got it, making this function in a javascript helped me to sort it out. function encodeValue(value) { return encodeURIComponent(value); } Thanks, Link to comment https://forums.phpfreaks.com/topic/212635-ajax-calling-not-encoding-in-utf-8ie-problem/#findComment-1107728 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.