Javascript-форум (https://javascript.ru/forum/)
-   jQuery (https://javascript.ru/forum/jquery/)
-   -   Ajax json из jQuery 1.3 в 1.4 (https://javascript.ru/forum/jquery/17119-ajax-json-iz-jquery-1-3-v-1-4-a.html)

pro10026 06.05.2011 15:33

Ajax json из jQuery 1.3 в 1.4
 
Есть скрипт, работа которого прекращается при переходе с jquery 1.3 на 1.4. Я не могу понять почему... Вот список изменений 1.4 клац. Помогите плз
<script>
jQuery(document).ready(jQuery(function() {
jQuery.ajax({
type: 	"POST",
url: 	"/engine/modules/gett.php",
data: 	"torrnetnamefile={$torrent1}",
dataType: "json",
success: function(data)
{
$("#total_downloaded-{$row['id']}").text(data.t_downloaded);
$("#total_seeds-{$row['id']}").text(data.t_complete);
$("#total_leachers-{$row['id']}").text(data.t_incomplete);
$("#torrent_size-{$row['id']}").text(data.t_size);
$("#torrent_hash-{$row['id']}").text(data.t_hash);
$("#torrent_name-{$row['id']}").text(data.t_name);
$("#torrent_ann-{$row['id']}").text(data.t_ann);
$("#torrent_priv-{$row['id']}").text(data.t_priv);
}
});
    $("#dwntorrenttxtx-{$row['id']}").toggle(
      function () {
        $("#div_torrentfiles-{$row['id']}").fadeIn("slow");
      },
      function () {
        $("#div_torrentfiles-{$row['id']}").fadeOut("slow");
      });
}));
</script>

Kolyaj 06.05.2011 15:41

Потому что json валидный надо возвращать.

pro10026 06.05.2011 16:10

Цитата:

Сообщение от Kolyaj (Сообщение 103616)
Потому что json валидный надо возвращать.

Отдается вот так:
echo <<<HTML
{"status":"$tx_status",
"t_complete":"$tx_cx1",
"t_downloaded":"$tx_dx1",
"t_incomplete":"$tx_ix1",
"t_size":"$t_size",
"t_hash":"$t_hash",
"t_name":"$t_name",
"t_ann":"$t_ann",
"t_priv":"$priv"}
HTML;

Kolyaj 06.05.2011 16:23

В json не может быть переводов строк.

pro10026 06.05.2011 19:47

Цитата:

Сообщение от Kolyaj (Сообщение 103627)
В json не может быть переводов строк.

Помогло, спасибо!


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