может кто-нибудь помочь мне с этим простым кодом, у меня есть кнопка, в которой при отправке пользователем будет загружен javascript, который будет вызывать запрос ajax, чтобы просто обновить одно поле в моей таблице, чтобы я прошел Контроллер илит, которые выполняют этот метод на мой запрос AJAX, но ничего happens.here мой взглядAjax request no response using codeigniter
<!--body part--->
echo "<button class='btn btn-info dropdown-toggle notify-btn' data-toggle='dropdown' 'href='#' value=".$count." onclick='notify(".$count.")'>".$count."</button>";
<!--Here is my javascript--->
function notify(count){
$.ajax({
type: 'POST',
url:<?php echo base_url("notifications/set")?>,
success:function(response){
alert("Success");
}
});
}
<!--Here is my Controller--->
class Notifications extends CI_Controller{
public function __construct()
{
parent::__construct();
$this->load->model('notification_model');
}
public function index(){
$this->set();
}
public function set(){
$this->notification_model->set_notifications();
}
<!--Here is my Model--->
<?php class Notification_model extends CI_Model {
function set_notifications(){
$this->db->where('notification_status','active');
$this->db->set('notification_status',"inactive",FALSE);
$this->db->update('messages');
}
}
?>
Пожалуйста, оставьте свои сообщения об ошибках, которые вы получаете в Js консолях –
когда я нажимаю nothng hapens, но Я решил это, используя библиотеку cjax codeigniter, но stil wuld luv to knw hw для решения без какой-либо библиотеки. – bobin56