-1

我使用$.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]. 我怎样才能得到它作为纯文本

4

2 回答 2

4

use success, instead, like:

success: function(json){
    console.log(json);
}
于 2013-10-24T05:45:23.017 回答
0

Try this

$.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.
          }
      });

You can check the output in your browser console. you can use ctrl + shift + J in Google Chrome Browser

于 2013-10-24T05:46:10.673 回答