$.ajax 结果作为 [对象对象] 获取


$.ajax result getting as [Object object]

我使用$.ajax函数将数据传递给php

$.ajax({
         type: "GET",
         url: "http://artinnmedia.com/index/get_gallery",
         data: {movie_id:id},
         complete: function(json){
             alert(json);
          }
      });

而 PHP 代码是

    $id =$this->input->get('movie_id');
$movie=$this->site_model->get_movie_single($id);
extract($movie[0]);
    if($gallery_id==null)
    {   
    print 0;
    }
    else
    {
    print $gallery_id;
    }

现在的问题是结果是$.ajax功能作为[Object object]。如何以纯文本形式获取它

使用成功,例如:

success: function(json){
    console.log(json);
}

试试这个

$.ajax({
         type: "GET",
         url: "http://artinnmedia.com/index/get_gallery",
         data: {movie_id:id},
         complete: function(json){
             console.log(json); // check data here in your browser console.
          }
      });

您可以在浏览器控制台中检查输出。 您可以在谷歌浏览器中使用ctrl + shift + J