请帮助jQuery代码:
jQuery.ajax({url:nextPortionLink,
success: function(data) {
nextPortion = jQuery("#productList", data).html();
}});变量data有带#productList, .productImage, a, img的html页面...
但是这些选择器在这里都不起作用。为什么?
jQuery(data).find("anything")也不能工作
Opera9.6的nextPortion == null
此代码适用于IE7、8FF3-4,但不适用于Opera9.6和IE9
发布于 2011-04-17 22:52:25
检查jQuery的dataType,应该是"html":
jQuery.ajax({
url:nextPortionLink,
dataType: "html",
success: function(data) {
nextPortion = jQuery("#productList", data).html();
}
});您必须确保您的jQuery obj是dataType 'html',如果不是(OP将返回null),您可以使用以下命令强制它为'html‘:
var data = jQuery(data).html();在这里找到可用的示例:http://jsfiddle.net/aA3VN/1/
https://stackoverflow.com/questions/5612620
复制相似问题