0 Comments

Using jQuery dialog with javascript in IE9

By Kevin / Posted on 03 November 2011

Don’t you just love Internet Explorer?  I love the development tools which are of virtually no help other than throwing a javascript error that is so broad it basically means:

“you have an error in some javascript somewhere in some file”

Wow…thanks!  That was very helpful.

Here was the problem.  We are accessing some code from another domain as we are in a transition from one version of the application to another.  Because we have changed everything from the ground up the migration required that we move slowly and not just flip the switch.  Therefore we are using jQuery and jsonp to access some code from our new system in the old system.  We have one function where you set a market and we use jQuery’s dialog() function to popup a window which then pulls in the jsonp file to populate the country, state and city dropdowns.  It worked great.  It was fast and did everything that we needed it to do (after I figured out how to make jQuery and jsonp play nice)…..in Firefox.  Once I pulled it up in IE it did nothing and threw a random error, script1002: syntax error, which did nothing for me.  It referenced some line number that was blank and didn’t really tell me anything about the error.  So, I jumped in and started commenting OUT code to figure out where the problem was.  After a couple of hours…here is what I found out.

Dont use ‘<!–    –>’ in your javascript

I guess that I missed a memo or something because I thought that properly formatted javascript looked like this:

<script type=”text/javascript”>
<!–
#CODE_HERE#
–>
</script>

well, if you have that opening and closing brackets…it breaks.  Oh well, at least it only took a couple of hours.

Hope this helps someone before they waste two hours like I did.

 

Categories

JavaScript, jQuery

 
 
 

Do you have something to say?