Javascript-форум (https://javascript.ru/forum/)
-   Events/DOM/Window (https://javascript.ru/forum/events/)
-   -   Проблемма с getJSON и jquery библиотеками (https://javascript.ru/forum/events/36130-problemma-s-getjson-i-jquery-bibliotekami.html)

Gerg007 04.03.2013 22:08

Проблемма с getJSON и jquery библиотеками
 
Здравствуйте, такая проблемма есть код

$(document).ready(function() { 

    $.getJSON("json.php",  {chveneba:'1'}, function(json) {
      if (json.length > 0) {
        for (i=0; i<json.length; i++) {
          var place = json[i];
          var category = json[i].tag;
          addLocation(place,category);
        }
      }
    });
});


проблемма в том что когда подключаю библиотеку

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js"></script>

всё работает но мне надо было сменить библиотеку на новую

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>

и перестала работать джисон как поправить? в чём проблемма?

imsha 05.03.2013 05:17

вероятно сам json ответ содержит ошибки.

Вот что указано в api http://api.jquery.com/jQuery.getJSON/

Important: As of jQuery 1.4, if the JSON file contains a syntax error, the request will usually fail silently. Avoid frequent hand-editing of JSON data for this reason. JSON is a data-interchange format with syntax rules that are stricter than those of JavaScript's object literal notation. For example, all strings represented in JSON, whether they are properties or values, must be enclosed in double-quotes.


Часовой пояс GMT +3, время: 17:34.