Open local xml file

Hi

I tried to open local xml file with ajax request like
var request = GXmlHttp.create();
request.open(“GET”, “RSS.xml”, true);
request.onreadystatechange = function() {
or

if (window.XMLHttpRequest){
xmlhttp=new XMLHttpRequest();}
else{
xmlhttp=new ActiveXObject(“Microsoft.XMLHTTP”);}
xmlhttp.open(“GET”,“C:\RSS.xml”,false);
xmlhttp.send();
xmlDoc=xmlhttp.responseXML;

but i had always a error message.

I see that with Dxhtml we can open it :

z = new dhtmlXCombo(“combo_zone”, “alfa2”, 200, ‘image’);
z.setDefaultImage(“Icon/blue-dot.png”);
z.loadXML(“Icon.xml”);

Did i forgot some thing? Please a i need your help

It is said that ajax should use http protocal.
I’m not very sure.

Hi,

a file can be loaded by Ajax if it is in the same domain as the html page. Therefore, xmlhttp.open(“GET”,“C:\RSS.xml”,false); can throw an error.

You may also use our dhtmlxAjax. Here is the sample:
dhtmlxAjax/samples/01_samples_of_usage/01_send_request.html
dhtmlx.com/docs/products/dht … quest.html

Hi
thanks you for your help

First i don’t understand how can i use the http protocol (for jyginger). I think with .send() we already use it. can you give more explanations. Thanks
i looked to the code of dhtmlxcommon.js. There are the same requests (as mentionned on the web) with an if wether it’s IE or firefox…the difference that there is an other function to wait until the xml loaded (dtmlXMLLoaderObject.prototype.waitLoadFunction=function(dhtmlObject)). is there a way to code this function simply?
effectively, i tried to use the dhtmlxAjax. specificaly i did :
var t=new dtmlXMLLoaderObject(true);
t.async=(arguments.length<3);
t.waitCall=null;
t.loadXML(“RSS.xml”)
it works. the problem that i dont know how to manipulate the variable t. i used t.documentElement.getElementsByTagName(“coordinates”); to reach all of my coordinates included in RSS.xml but it doesn’t work

How can i manipulate t variable??

Thank you

2akifsaid:

  1. I debug codes under web server(installed locally,say,appache,iis) and visit web files through localhost/…, it uses the http protocal.

  2. I use dhtmlx in my codes, as well as jQuery, and I usually use jquery’s $.ajax(…) for ajax requests. Note: returned xml from dhtmlx(such as myform.send(url,function(xml){}) ) is accepted only when it is transformed by jquery.xmldom() function.

hope it will help you.

How can i manipulate t variable??

method dtmlXMLLoaderObject is not public. Here is the documentation about dhtmlxAjax:

docs.dhtmlx.com/doku.php?id=dhtmlxajax:toc