Laravel 5.8 Ajax Crud Tutorial - Update or Edit Data
HTML-код
- Опубликовано: 28 сен 2024
- Learn How to Edit or Update MySQL Data in Laravel 5.8 by using Ajax and Bootstrap Modal. How to make Ajax Crud Application in Laravel 5.8 using Bootstrap modal without page refresh and reloading page. How to make Laravel 5.8 CRUD with modal and Ajax. How to fetch single row data and display on Bootstrap modal in Laravel 5.8 using Ajax. Laravel 5.8 Ajax Crud Tutorial from scratch.
www.webslesson...
He didnt mention anything about to add routes in the web.php. But that is available in the source code.In his source code the given route for the update function is not working for me. i dont know about for the others? he added, Route::post('ajax-crud/update', 'AjaxCrudController@update')->name('ajax-crud.update'); this line of code not working for me and i dont know where is the id for updating the row? that is the issue then i found the solution.That is given bellow
Route::post('ajax-crud/update/{id}', 'AjaxCrudController@update')->name('ajax-crud.update'); and in the Route url
url: "{{ route('ajax-crud.update','id') }}".I added the id.Any one have issues like this. try this code. Hope it will work.
Thank you from the heart
ajax is not working ..i followed every instructions..
the same
Edit Button is not working..Plz help..
can you provide a snippet ? i think this is working fine
@@thesau1595 I also experienced it
Can i see the code ?
@@thesau1595 cant post data ,
if($('#action').val() == "Edit")
{
$.ajax({
url:"{{ route('produk.update') }}",
method:"POST",
data:new FormData(this),
contentType: false,
cache: false,
processData: false,
dataType:"json",
success:function(data)
{
var html = '';
if(data.errors)
{
html = '';
for(var count = 0; count < data.errors.length; count++)
{
html += '' + data.errors[count] + '';
}
html += '';
}
if(data.success)
{
html = '' + data.success + '';
$('#sample_form')[0].reset();
$('#store_image').html('');
$('#user_table').DataTable().ajax.reload();
}
$('#form_result').html(html);
}
});
}
});
@@mizarzulmi1410 are you using data tables?
the problem of the edit ajax it's / of url start
thx, :)
JAJAJAJA 10100101AJJAJA010101JAJ
Can you change image source on update?
Hello Weblesson teacher.
I'm have a problem with the edit method. I'm copied it method exactly but edit button don't show nothing. Can You help me please?.. than you in advance for your help!!