ajax not working in codeigniter

Posted by user1800797 on Stack Overflow See other posts from Stack Overflow or by user1800797
Published on 2012-11-05T16:53:34Z Indexed on 2012/11/05 17:00 UTC
Read the original article Hit count: 160

Filed under:
|
|

I'm trying to send a post request using the ajax jquery function and return some data into a window asynchronously. Here's what I have so far. It doesn't seem to be working.

in the view:

$.ajax({
          url: '/dashboard/presskits/media/get_video_link/',
          type: 'POST',
          dataType: 'json',
          data: { encoded_link : encoded_link },
          cache: false,
          success: function(output_string){
            // $('#edit_video_info').append(output_string);
            alert(output_string.url_data);
          } // End of success function of ajax form
          }); // End of ajax call
}); 

in the controller:

 public function get_video_link()
{
    $temp_url = $this->input->post('encoded_link');
    $output_string = json_encode(array('url_data' => $temp_url));
            return $output_string;
    } 

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about AJAX