有关getJSON在IE下失效的问题

前端之家收集整理的这篇文章主要介绍了有关getJSON在IE下失效的问题前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
$('#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下正常。@H_301_5@

header ( 'Content-Type: text/javascript; charset=UTF-8' );
		$this->display();
(lnmp环境+thinkPHP 原文链接:https://www.f2er.com/json/290521.html

猜你在找的Json相关文章