我正在为网站开发“每日行情”功能。它工作正常,但出现了JavaScript错误“ TypeError:对象不是函数”。
jQuery(function ($) {
var output = '';
$.post( "getquote.php?getjson", function( data ) {
var data = JSON.parse(data);
console.log(data);
$.each(data, function(index, value){
output += '<p>'+value.quote+'</p>';
});
$('#qotd').html(output)('refresh');
});
});
错误指向的行是: $('#qotd').html(output)('refresh');
该代码将一个ID为qotd(当天报价)的数据库记录输出到div标签中。
就像我说的那样,代码可以完美地工作,因此我必须仅略微丢失一些东西。
为什么需要refresh
?只需将其删除:
$('#qotd').html(output);
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句