I was wondering how to access file addresses containing latin characters, with jquery ajax. I tried to retrieve data in xml files with the script below:
$.ajax({
type:'get',
url:encodeURI('configuration/'+(value).toLowerCase()+'.xml'),
dataType:'xml',
contentType:'application/x-www-form-urlencoded;charset=utf-8;',
success:function(content){
$('#content').html($('content',content).text().replace('nL','<br/>'));
});
});
but the problem surges when I try to access xml files whose addresses' contain unicode characters like intrusão.xml
.
It keeps loading and nothing happens.
Below are are the contents of the xml file example named intrusão.xml
:
<?xml version="1.0" encoding="utf-8"?>
<document>
<content>First line.nLSecond line.</content>
</document>