문제

I have a embeddable Javascript (Cannot use jQuery) Event Widget for our Chamber of Commerce:

http://www.cvchamber.ca/calendar-widget/

Essentially you copy/paste this into your site:

<!--
CV Chamber of Commerce Event Widget
Copy and paste where you want the calendar to appear.
-->
<div id="event-widget"></div>
<script src="http://goo.gl/jxLBvi"></script>

The script itself is this:

function callback(jsondata){
    document.getElementById('event-widget').innerHTML = jsondata.html ;
}
var script = document.createElement('script');
script.src = 'http://www.cvchamber.ca/wpcvcc/wp-admin/admin-ajax.php?action=get_events&count=5&callback=callback';
document.body.appendChild(script);

The URL http://www.cvchamber.ca/wpcvcc/wp-admin/admin-ajax.php?action=get_events&count=5&callback=callback simply retrieves some HTML for placement inside the div.

It works in all browsers except for IE, what can/should I be doing to make this compatible?

도움이 되었습니까?

해결책

IE doesn't recognize "application/json" as executable javascript, so it rejects the script. The server should instead be returning with the contentType set to "text/javascript" for JSONP requests.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top