Guest User

Untitled

a guest
Jan 20th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. <a href="<?php echo base_url();?>mantenimiento/categorias/delete_funcion/<?php echo $categoria->id;?>" class="btn btn-danger btn-remove"><span class="fa fa-remove"></span></a>
  2.  
  3. var base_url= "<?php echo base_url();?>";
  4. $(".btn-remove").on("click", function(e){
  5. e.preventDefault();
  6. var ruta = $(this).attr("href");
  7. //alert(ruta);
  8. $.ajax({
  9. url: ruta,
  10. type:"POST",
  11. success:function(resp){
  12. //http://localhost/ventas_ci/mantenimiento/productos
  13. window.location.href = base_url + resp;
  14. }
  15. });
  16.  
  17. public function delete_funcion($id)
  18. {
  19. $data = array
  20. (
  21. 'estado' => "0",
  22. );
  23. $this->Categorias_models->update_model($id,$data);
  24. echo "mantenimiento/categorias";//retorna el controlador categorias para q pueda actualizarce la pagina
  25. }
  26.  
  27. public function update_model($id,$data)
  28. {
  29. $this->db->where("id", $id);
  30. return $this->db->update("categorias", $data);
  31. }
Add Comment
Please, Sign In to add comment