我从言辞转向密码,但我正在竭力要求控制员从这里的一个支队站接手。
我的亲身认为:
<a class="add_playlist" href="5657584"><img src="http://icons.iconarchive.com/icons/dryicons/simplistica/32/add-icon.png" alt="playlist"/></a>
页: 1
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type= text/javascript >
$( .add_playlist ).live( click , function() {
alert( add );
var video_url = $(this).attr( href );
$.post("http://localhost/code/index.php/home/add_playlist", {video_url: video_url}, function(response) {
console.log(response);
});
return false;
});
因此,我正试图做的是,把这一职责传给我家的控制员,叫他增加角色。 这里是我家中控制员的守则。
<?php if ( ! defined( BASEPATH )) exit( No direct script access allowed );
class Home extends CI_Controller {
function add_playlist(){
$this->load->model( home_model );
// if HTTP POST is sent, add the data to database
if($this->input->post( video_url )) {
$video_url = $this->input->post( video_url );
$this->home_model->add($video_url);
} else {
}
}
}
return false;
});
</script>
And here is my home model
<?php
class home_model extends CI_Model {
function add($data) {
$this->db->insert( playlist , $data);
}
}
So all i want it to do is add the href to the database can someone please scan this and helps
增 编
这是它 throw倒的错误。
add_playlistPOST http://localhost/code/index.php/home/add_playlist 500 (Internal Server Error)