bestiejs / json3

A JSON polyfill. No longer maintained.
https://bestiejs.github.io/json3
Other
1.01k stars 150 forks source link

Not working in >IE8 #64

Closed guit4eva closed 10 years ago

guit4eva commented 10 years ago

I have tried both JSON2 and JSON3, and I can't get it to work. Below is my JSON function, can anyone please tell me what is wrong?

jQuery(document).ready(function() { (function ($) { $('select[name="post_type"]').change(function (event) { $("#location-dropdown").prop("disabled", true); $('select[name="location"]').html(""); $.post("<?php echo admin_url('admin-ajax.php'); ?>", { action: 'wpse158929_get_terms_for_cpt', post_type: $(this).val(), taxonomy: <?php echo json_encode( $taxonomy ); ?>, current_selected: $('select[name="location"]').val(), nonce: <?php echo json_encode( wp_create_nonce( 'wpse158929_get_terms_for_cptsubmit' ) ); ?> }, function( response ) { if ( response && !response.error ) { $('select[name="location"]').html(response.html); $("#location-dropdown").prop("disabled", false); } }, 'json' ); }); // Remove if you don't want to call change immediately. $('select[name="post_type"]').change(); })(jQuery); });

ghost commented 10 years ago

What's the expected behavior? What are you actually seeing (errors, broken UI elements)?

guit4eva commented 10 years ago

I have two dropdowns in Wordpress, a category dropdown and a taxonomy dropdown. The taxonomy dropdown is populated based on the category dropdown. The first answer of here is my exact code:

http://wordpress.stackexchange.com/questions/158929/filter-second-dropdown-tax-based-on-first-dropdown-cpt

It populates in every other browser, but in IE it shows the "loading..." text and then a blank set of options

ghost commented 10 years ago

Hmm, okay. I've never used WordPress or PHP, so I don't know how much I can help. You mentioned this only occurs in IE > 9; did you see any exceptions in the dev tools console? You could also try running your code without including JSON 2 or 3, since IE >= 8 includes a native JSON implementation. If the list still doesn't populate, it's likely not a JSON 3 issue.

guit4eva commented 10 years ago

Yea, I've tried without JSON 2 or 3, and same thing, with no errors. Flip ha ha, I've basically spent my whole day trying to figure out why this stupid browser doesn't work like all the others. Anyways, thanks for trying to help, I'll keep trying and see what I can come up with

On Thu, Aug 28, 2014 at 7:09 PM, Kit Cambridge notifications@github.com wrote:

Hmm, okay. I've never used WordPress or PHP, so I don't know how much I can help. You mentioned this only occurs in IE > 9; did you see any exceptions in the dev tools console http://msdn.microsoft.com/en-us/library/ie/gg589512%28v=vs.85%29.aspx? You could also try running your code without including JSON 2 or 3, since IE >= 8 includes a native JSON implementation. If the list still doesn't populate, it's likely not a JSON 3 issue.

— Reply to this email directly or view it on GitHub https://github.com/bestiejs/json3/issues/64#issuecomment-53757741.

ghost commented 10 years ago

No worries; sorry I couldn't really help. I'll go ahead and close this issue...