SHARE
TWEET

Untitled

a guest Jun 17th, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <button id="eliminarArticulo" ruta = "{{URL::to('auto/eliminarArticulo')}}" onclick="eliminarArticulo({{$detalle_modelo->idetalleModelo}})" class="btn btn-outline btn-danger"><i class="fa fa-trash"></i></button>
  2.      
  3. <script>
  4.  
  5.         function  eliminarArticulo(id) {
  6.  
  7.              var ruta = $('#eliminarArticulo').attr('ruta');
  8.              var url = ruta+"/"+id;
  9.  
  10.           //   alert(url)
  11.  
  12.             $.post({
  13.                 url: url,
  14.                 data: {id:id},
  15.                 dataType: 'json',
  16.                 success : function (res) {
  17.                    // console.log(res);
  18.                 }
  19.             });
  20.  
  21.         }
  22.  
  23. </script>
  24.      
  25. Route::group(['prefix' => 'auto'], function(){
  26.     Route::get('crear', 'AutoController@crear')->name('auto.crear');
  27.   Route::post('registrar', 'AutoController@registrar')->name('auto.registrar');
  28.     Route::get('listar', 'AutoController@listar')->name('auto.listar');
  29.     Route::get('editar/{cod}', 'AutoController@editar')->name('auto.editar');
  30.     Route::post('actualizar', 'AutoController@actualizar')->name('auto.actualizar');
  31.     Route::get('ver/{cod}', 'AutoController@ver')->name('auto.ver');
  32.     Route::post('guardarArticulo', 'AutoController@guardarArticulo')->name('auto.guardarArticulo');
  33.     Route::get('editarArticulo/{cod}', 'AutoController@editarArticulo')->name('auto.editarArticulo');
  34.     Route::post('actualizarArticulo', 'AutoController@actualizarArticulo')->name('auto.actualizarArticulo');
  35.     Route::post('ActualizarEstadoAuto/{cod}', 'AutoController@ActualizarEstadoAuto')->name('auto.ActualizarEstadoAuto');
  36.     Route::post('eliminarArticulo/{cod}', 'AutoController@eliminarArticulo')->name('auto.eliminarArticulo');
  37.  
  38. });
  39.      
  40. public function eliminarArticulo(Request $request){
  41.  
  42.       return $request;
  43. }
  44.      
  45. <button id="eliminarArticulo" onclick="eliminarArticulo({{$detalle_modelo->idetalleModelo}})" class="btn btn-outline btn-danger"><i class="fa fa-trash"></i></button>
  46.      
  47. function eliminarArticulo(id) {
  48.  $.ajax({
  49.     url: 'url' + id,
  50.     type: 'DELETE',
  51.     success: function(result) {
  52.         // bla bla
  53.     }
  54.  });
  55.      
  56. public function eliminarArticulo($id) {
  57.   // delete
  58.   $articulo = Articulo::find($id);
  59.   $articulo->delete();
  60.  
  61.   return response()->json([
  62.     'message' => 'Articulo Eliminado'
  63.   ]);    
  64. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top