dimanche 28 juin 2015

JS Ajax Get call to a url returning a document

When I go to the url by a browser, it returns a response successfully and starts an automatic download of the document.
I would expect it to return an xml file in the first place but the service cannot be changed and it returns a file whose type is document.

The document's content is as follows; It basically has a list of urls.

name endpoint

name1 url1

name2 url2

name3 url3

.

.

First, how I should make the call successfully by Javascript? The following is always in error.

$.ajax({
         url: "http://url",
         dataType: "document",
         success:  function(document) {                     
                 console.log("success");
         },
         error: function() {                     
                 console.log("error");

         }
     });

Is there any way, after calling the service, to keep the file on the air ( without saving ) then parse each line ?

Aucun commentaire:

Enregistrer un commentaire