samerhannoun Posted July 11, 2011 Share Posted July 11, 2011 Hi Guys,, I face a problem with IE7 and higher with AJAX request encoding, in brief, I have drop down menu contains folders names in Swedish language, and its contains some special characters, when the user change the select (dropdown) form element, there something should be done. everything is ok whith folders names thats not contain Swedish characters, the other folder(contain Swedish letters) when the user choose it nothing happen. So I think its encoding problem, what can I do to solve that?this is my function $("#edit-display-section").change(function(){ var txt= $("#edit-display-section option:selected").text();var fire = function(data) { document.getElementById('samer').innerHTML=(data); } $.ajax({ url: "calc/ajax/"+txt, type: 'POST', success:fire, contentType: "application/x-www-form-urlencoded;charset=utf-8", beforeSend: function(xhr) { xhr.setRequestHeader("Accept-Charset","utf-8"); xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=utf-8"); }, });the php file also UTF encode.thanks in advance for any help Link to comment Share on other sites More sharing options...
Ingolme Posted July 11, 2011 Share Posted July 11, 2011 Encode the data for URI like this:var txt= encodeURIComponent( $("#edit-display-section option:selected").text() ); Link to comment Share on other sites More sharing options...
samerhannoun Posted July 11, 2011 Author Share Posted July 11, 2011 Encode the data for URI like this:var txt= encodeURIComponent( $("#edit-display-section option:selected").text() );Thanks a lot,, Working now Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.