加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

有关getJSON在IE下失效的问题

发布时间:2020-12-16 19:24:05 所属栏目:百科 来源:网络整理
导读:$('#letter-b a').click(function(){$.getJSON('__PUBLIC__/b.json',function(data){$.each(data,function(entryIndex,entry){var html = 'div class="entry"';html += 'h3 class="term"' + entry['term'] + '/h3';html += 'div class="part"' + entry['part
$('#letter-b a').click(function(){
		
		$.getJSON('__PUBLIC__/b.json',function(data){
			
			$.each(data,function(entryIndex,entry){
				var html = '<div class="entry">';
				html += '<h3 class="term">' + entry['term'] + '</h3>';
				html += '<div class="part">' + entry['part'] + '</div>';
				html += '<div class="definition">';
				html += entry['definition'];
				html += '</div>';
				html += '</diiv>';
				$('#dictionary').append(html);
			});
		});
		return false;
	});
写了一个ajax的函数,结果在Chrome和IE中什么反应也没有,
[{
 "term": "BACCHUS","part": "n.","definition": "A convenient deity invented by the...","quote": [
    "Is public worship,then,a sin,","That for devotions paid to Bacchus","The lictors dare to run us in,"And resolutely thump and whach us?"
    ],"author": "Jorace" 
},{
 "term": "BACKBITE","part": "v.t.","definition": "To speak of a man as you find him when..."
},{
 "term": "BEARD","definition": "The hair that is commonly cut off by ..."
}]

检查了一下,文件中开始和结尾的括号[]没有加上去。加上去之后,chrome下可以正常显示,在IE下还是没有反应。然后再调用的php文件中定义了字符编码格式,IE下正常。

header ( 'Content-Type: text/javascript; charset=UTF-8' );
		$this->display();
(lnmp环境+thinkphp)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读