0

I have used jquery for my page and all browsers but in IE it's not working and after a lot of struggle I came to know it was because json is not working and I tried placing this code and even after then it's not working.

<!--[if lt IE 8]>
    <script src="http://www.json.org/json2.js"></script>
<![endif]-->

So, how can I make json to work for ie7, ie8...?


I've something like this:

<?php
$app = JFactory::getApplication();
$menu = $app->getMenu();
$link1 = 'index.php?Itemid=546';
$link2 = 'index.php?Itemid=540';
?>
<!--[if lt IE 8]>
    <script src="http://www.json.org/json2.js"></script>
<![endif]-->
<script>
jQuery(document).ready(function($){  
var $morenews = $('<a>',{
    class: 'all-news-link',
    href: <?php echo json_encode( $link1 ); ?>
});
Bhojendra Rauniyar
  • 83,432
  • 35
  • 168
  • 231
  • 8
    "JSON is not working" -- what *exactly* is not working? – Jon Nov 07 '13 at 09:06
  • Is it possible that your site is https and you try to download http ?. also dont count on json.org to be alive forever. – Royi Namir Nov 07 '13 at 09:07
  • closely related to [JSON - Not working in Internet Explorer 8](http://stackoverflow.com/questions/12976801/json-not-working-in-internet-explorer-8) – Praveen Nov 07 '13 at 09:07
  • possible duplicate of [JSON on IE6 (IE7)](http://stackoverflow.com/questions/2503175/json-on-ie6-ie7) – Tushar Gupta - curioustushar Nov 07 '13 at 09:10
  • And where do you use JSON in javascript right now? How do you know that it is not working? `json_encode( $link1 )` is in php and will result in `href: "index.php?Itemid=540"` in the final page. (You don't use `JSON.parse` or `JSON.stringify` in the code you showed) – t.niese Nov 07 '13 at 09:16
  • after the variable defined.... – Bhojendra Rauniyar Nov 07 '13 at 09:17

1 Answers1

1

The file you're trying to link to is not there (404 page).

Try this.

Community
  • 1
  • 1
Adaz
  • 1,627
  • 12
  • 14