Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php jQuery find()在Google Chrome中返回空字符串_Php_Jquery_Ajax_Firefox_Google Chrome - Fatal编程技术网

Php jQuery find()在Google Chrome中返回空字符串

Php jQuery find()在Google Chrome中返回空字符串,php,jquery,ajax,firefox,google-chrome,Php,Jquery,Ajax,Firefox,Google Chrome,我正在使用jQuery设置一个Ajax请求,该请求从PHP脚本获取一个XML提要,然后从提要中解析一些信息并将其插入DOM它在Firefox中运行良好;但是,在Chrome中,title元素得到一个空字符串。 以下是Ajax请求的基本设置: $.get('feed.php', function(oXmlDoc) { $(oXmlDoc).find('entry').each(function() { $(this).find('title').text(); $(this).

我正在使用jQuery设置一个Ajax请求,该请求从PHP脚本获取一个XML提要,然后从提要中解析一些信息并将其插入DOM它在Firefox中运行良好;但是,在Chrome中,
title
元素得到一个空字符串。

以下是Ajax请求的基本设置:

$.get('feed.php', function(oXmlDoc) {
  $(oXmlDoc).find('entry').each(function() {
    $(this).find('title').text();
    $(this).find('id').text();
    // do other work...
  }); 
});
值得一提的是,下面是从提要中获取数据的PHP脚本。我之所以使用cURL,是因为我在跨域发出请求(因为它是解决当前问题的一个快速而肮脏的解决方案)

XML数据被正确返回,我可以在Chrome中看到同级节点的值(例如
ID
),但是,无论出于何种原因,我继续为
title
节点获取一个空字符串

编辑:根据请求,以下是相关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>

http://TheAddress.com/feed/01
职位名称
汤姆
2009-11-05T13:46:44Z
2009-11-05T14:02:19Z
...

示例XML中的页面标题中有一个HTML实体。这可能会导致问题。这是我在这个问题上找到的一个答案

我想知道其他特殊角色是否也是如此

主页标题如下所示:

<title>The Address Hotels + Resorts</title> 
酒店+度假村的地址

我还没有尝试过,但请确保返回的xml具有正确的内容类型(text/xml)。您还可以将数据类型设置为xml。

我也有同样的问题。 似乎Chrome在ajax中不处理html标记。
尝试将XML和JS中的“title”更改为“booktitle”。

您可以发布XML片段吗?我最终需要在PHP脚本中将内容类型指定为rss+XML。$。在那之后,get()工作得很好。
<title>The Address Hotels + Resorts</title>