ajax not working in codeigniter
- by user1800797
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;
}