javascript - Read csv directly from url in html using js -


i working on html & js in display yahoo finance stock in table format. data in csv. want js directly read data url

the url http://ichart.finance.yahoo.com/table.csv?s=ril.bo

the code try stackoverflow working in localhost url.

 var txtfile = new xmlhttprequest();     txtfile.open("get", "http://ichart.finance.yahoo.com/table.csv?s=ril.bo", true);     txtfile.onreadystatechange = function() {       if (txtfile.readystate === 4) {  // makes sure document ready parse.         if (txtfile.status === 200) {  // makes sure it's found file.           alltext = txtfile.responsetext;           lines = txtfile.responsetext.split("\n"); // separate each line array           alert(alltext);         }       }     } 

thanks

you trying cross domain request being blocked.

you need write server side script fetch data you.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -