javascript - Getting page source from remote location almost works - just need to get the result into a variable -


having worked through previous postings , results of other searches, seem able want appears data object rather text can assign variable.

i limited javascript in environment working in , want use string functions on returned data can search terms.

this url format returns data object - result asked open or save text file:

http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20html%20where%20url%20%3d%20%22http://www.redrag.info/index.htm%22%20and%20xpath%3d%22*%22&format=xml&callback=cbfunc

(you can replace url - http://www.redrag.info/index.htm - within example above 1 of own if wish)

instead of opening text file, can use javascript document functions assign output variable?

thanks.

remove callback=cbfunc , define yours callback function. , can change format=json format=xml because simple handle. data , whatever want data

$.getjson("http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20html%20where%20url%20%3d%20%22http://www.redrag.info/index.htm%22%20and%20xpath%3d%22*%22&format=json", function(data) {     alert(data); } ); 

http://jsfiddle.net/kriyeta/lo3m4gb2/4/


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -