0

Just using a random example with this webpage how would I be able to access and use the articleBody element of the page and then get the individual paragraph elements of the the articleBody? Meaning how would I get the paragraph elements as a string.

  • Why not set up a jsFiddle for us, as getting the JSON from YQL into the fiddle would be most of the work we need to do to even get started ? – adeneo Jan 05 '15 at 05:43
  • That's a fail, syntax error! – adeneo Jan 05 '15 at 05:53
  • In this case, when you're looking for certain elements, using the XML option in YQL is probably easier, as you can do this -> **http://jsfiddle.net/30tmwokb/** – adeneo Jan 05 '15 at 05:53
  • http://jsfiddle.net/30tmwokb/1/ – adeneo Jan 05 '15 at 05:54
  • @adeneo how would i then access the string in the document and is the use of yql still necessary since i used it to get around the Same Domain javascript policy? – user3878873 Jan 05 '15 at 06:00
  • Why not try it out, log the data to the console, and see if you can figure it out ? – adeneo Jan 05 '15 at 06:03
  • @adeneo yeah you still have to use yql but i tried printing p (the variable for the paragraphs in articleBody) but it didnt work and said that it was undefined, how would you get the data in p. – user3878873 Jan 05 '15 at 06:08
  • Did you see my example above, doesn't that get the text in the paragraphs ? – adeneo Jan 05 '15 at 06:11
  • @adeneo it does but it prints the text to the document not assigning it to any variable, and on a side note dude thanks so much for your help – user3878873 Jan 05 '15 at 06:16
  • If you haven't read it, you should -> http://stackoverflow.com/questions/14220321/how-to-return-the-response-from-an-ajax-call – adeneo Jan 05 '15 at 06:18
  • And getting the text to a variable would just be something like -> **http://jsfiddle.net/30tmwokb/2/** – adeneo Jan 05 '15 at 06:19

0 Answers0