I'm using jQuery to setup an Ajax request that grabs an XML feed from a PHP script and then parses some information out of the feed and inserts it into the DOM. It works fine in Firefox; however, in Chrome, I am getting an empty string for the title
element.
Here's the basic setup of the Ajax request:
$.get('feed.php', function(oXmlDoc) {
$(oXmlDoc).find('entry').each(function() {
$(this).find('title').text();
$(this).find('id').text();
// do other work...
});
});
For what it's worth, here's the PHP script that's grabbing data from the feed. I'm using cURL because I'm making the request across domains (and because it was a quick and dirty solution for the problem at hand).
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $str_feed_url);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$xml = curl_exec($curl);
curl_close($curl);
echo $xml;
The XML data is being returned correctly and I can see the values of the sibling nodes in Chrome (such as ID
), but, for whatever reason, I continue to get an empty string for the title
node.
Edit: As requested, here's a fragment of the relevant XML:
<entry>
<id>http://TheAddress.com/feed/01</id>
<title type="text">The Title of the Post</title>
<author><name>Tom</name></author>
<published>2009-11-05T13:46:44Z</published>
<updated>2009-11-05T14:02:19Z</updated>
<summary type="html">...</summary>
</entry>