为什么这对avgRent不起作用? YQL控制台使用以下语句提供值:
select * from html where url="http://www.zillow.com/widgets/zestimate/ZestimateSmallWidget.htm?did=zillow-shv-small-iframe-widget&type=iframe&forRent=true&address='5894+Dogwood+Cir+35111'" and xpath='//span[@id="zestimate-value"]'
但我的代码不会返回值。我可以对变量avgRent做错了吗?
var postcode = $('#postcode').val();
var address = $('#address').val();
$.get(makeUrl('http://www.zillow.com/widgets/zestimate/ZestimateSmallWidget.htm?did=zillow-shv-small-iframe-widget&type=iframe&forRent=true&address=5894+Dogwood+Cir&csz=35111'),
function(data) {
var context = $('<div />').html($(data).find('content').text ());
$('#avgRent').html($(context).find('span.zestimate-value').text());
});
<tr>
<td><strong>Average Monthly Rent: </strong></td>
<td><div id="avgRent"></div></td>
</tr>