Pergunta

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?

Foi útil?

Solução

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top