Link to home
Start Free TrialLog in
Avatar of Iekaa Emi
Iekaa Emi

asked on

How to read an XML file from FTP

I have task that need me to read an xml file that has been given to me. I've made some research, unfortunately I didn't find one that suit with my needs. I am using javascript to read the xml file. Is there any ways on how can I read the xml file using ftp? Your help is greatly appreciated.
ASKER CERTIFIED SOLUTION
Avatar of HainKurt
HainKurt
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Iekaa Emi
Iekaa Emi

ASKER

It is not a public ftp.
this is the address >>  http://ukhwah.dyndns.org:8080/cmlms/js/cust_status.xml
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
the url is giving error? What do you mean?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi expert,

The url given can be reach now. Could you help me?
https://jsfiddle.net/c3mdqw08/

<textarea id=xml cols=80 rows=12></textarea>

$("#xml").load("http://ukhwah.dyndns.org:8080/cmlms/js/cust_status.xml",
  function(response, status, xhr) {
    if (status == "error") {
      var msg = "Sorry but there was an error: ";
      $("#xml").html("ERROR!" + "\n" + msg + xhr.status + " " + xhr.statusText);
    }
  }
);

Open in new window

var msg = "Sorry but there was an error: ";

Is it same like alert function?
Could you explain? i do not understand.
this demo does not work on jsFiddle, but may work on your web server...
msg is just a variable name... in case of any issue, it will put

ERROR!
Sorry but there was an error: 0 error

into textarea instead of xml...

you can remove this (ignore error/error code)

var msg = "Sorry but there was an error: ";
$("#xml").html("ERROR!" + "\n" + msg + xhr.status + " " + xhr.statusText);

Open in new window


and just show a message

var msg = "Ooops! Could not load data!";
alert(msg);

Open in new window


in case of any error...