This does not work in IE ... Can anyone lend their brain as to why?
I have this small piece of code that simply pulls in a news release from one of our sites:
开发者_运维问答$(document).ready(function(){
items = [];
curr_item = 0;
$.getJSON('/press-release/feed/', function(data){
items = data;
render(0);
next = setInterval(next_release, 5000);
});
function next_release() {
//make sure we can't fall off the end of the array
if(curr_item == items.length-1)
curr_item = 0;
else
curr_item++;
render(curr_item);
}
function render( index ) {
item = items[index].fields;
$('#ticker-text a').fadeOut('slow', function(){
$(this).attr('href', '/press-release/' + item.slug).text(item.title);
$(this).fadeIn('slow');
});
}
});
Here's the HTML:
<div id="news-ticker">
<span id="ticker-text"><a href=""></a></span>
<ul>
<li><a href=""></a></li>
</ul>
</div>
For some reason this does not render the press release text from the JSON string in IE but it works fine in safari, chrome, firefox, opera... Can anyone help?
"IE really does a good job of enforcing correctness in JS. It will fail on {'aaa','bbb',}
due to the trailing comma, where FF
and Chrome will ignore the error. It's sometimes maddening to find the problem, but once you do your code is better for it."
-- Thanks David this was the issue.
精彩评论