Search code examples
jqueryregexarraysfeedeach

Pulling and using content with jQuery


I am struggling to figure out the best way to pull content from an RSS feed, use part of the content, then only show the used part of the data. I am using a jQuery plugin to pull a feed. I need to read the description field and use only part of the content from this field. I use regex to find the content. Then I use an each statement to manipulate the content and then print it. Two issues I am running into:

  1. The regex statement works on console.log for finding time, but then trying to print it with jQuery append, it fails. How should I pull the content? Is there another way?
  2. How do I only print out my manipulated content and get rid of the rest of the description field?

Here is my working example: http://jsfiddle.net/jkapaldo/D9RJz/8/

Thanks for your help!


Solution

  • Maybe i'm not understanding it correctly but are you trying to output the date and time instead of the description field which is inside the p tag?

    if so, you could simply add this

     $(this).html(month + "/" + day + "/" + year + " "+ time)
    

    Check out this fiddle