Category : ajax

As the title says, I am getting an error when I try to delete my data using laravel/ajax and the function inside the controller: Controller: public function destroy($category_id) { $category_delete = HmsBbrCategory::find($category_id); $category_delete->delete(); return response()->json([ ‘status’=>200, ‘message’=>’Category Deleted!’, ]); } Form & Ajax: `delete_category` is the id that opens the delete modal and `delete_category_btn` is ..

Read more

I am using yajra datable to fetch all the data from database dynamically using ajax and jquery. I have columns called "Membersid","Role" and so on…now What I want to do is for each value in "Membersid" there should a link which should redirect to details page of that particular membersid. Here is my route: Route::resource(‘/Memberdetails’, ..

Read more

my console shows this error whenever I try to update my form using my ajax code: PUT http://127.0.0.1:8000/clinical/bbr-category-configuration-update/1 500 (Internal Server Error) Route: Route::put(‘/bbr-category-configuration-update/{category_id}’, [BBRCategoryConfigurationController::class,’update’]); Ajax: $(document).on(‘click’, ‘.update_category’, function (e){ e.preventDefault(); var cat_id = $(‘#edit_cat_id’).val(); var update_data = { ‘category_name’ : $(‘#edit_category_name’).val(), ‘category_description’ : $(‘#edit_category_description’).val(), } //token taken from laravel documentation $.ajaxSetup({ headers: { ‘X-CSRF-TOKEN’: ..

Read more

I am new to Laravel and ajax and I am trying to apply Custom filters on Table data. I have followed this tutorial https://www.youtube.com/watch?v=XmUH049dk9I but unfortunately it’s not working. I have used yajra data tables. Here is my controller code. <?php namespace AppHttpControllers; use IlluminateHttpRequest; use DB; class CustomSearchController extends Controller { function index(Request $request) ..

Read more

Demonstration on how my catagory_id is being read (console.log each time I press the edit button) $(document).on(‘click’,’.edit_category’,function (e) { e.preventDefault(); var cat_id = $(this).val(); console.log(cat_id); }); My problem is when I try to output the an array shown at the consoles by clicking the edit button (testing purposes) Not sure how I still get the ..

Read more

I’m new to Jquery. I’m building a project with Laravel 7.28. I want users to crop an image before upload. I’ve searched on the net but all examples upload the image right after cropping. But I want the user to crop but not upload. I want users to upload the cropped image with input fields. ..

Read more

When the user province is selected automatically, the districts not listed, but if I select it manually, the districts is listed. I have 4 tables 1- User table 2- Province table 3- District table 4- learning table I want the user’s province to be automatically listed when the user logs in. If the user province_id ..

Read more

I am trying to output an if condition on my two columns in my laravel ajax: $.each(response.all_categories, function (key, item) { $(‘tbody’).append(‘<tr> <td><p class="font-weight-bold mb-0">’+item.category_name+'</p>’+item.category_description+'</td> <td>View: if (‘+item.config_view_type+’ == ‘P’){ <mark class="mark-orange">Public</mark> } elseif (‘+item.config_view_type+’ == ‘R’){ <mark class="mark-orange">Restricted</mark>} <br>Edit: </td> <td>View: </td> <td> <button type="button" value="’+item.category_id+’" class="btn btn-outline-secondary"> <i class="fas fa-edit"></i> Edit</button><button type="button" value="’+item.category_id+’" ..

Read more

I am trying to call my table contents using ajax append from a laravel controller function. I am getting this error though Ajax: function fetchcategory() { $.ajax({ type: "GET", url: "/clinical/bbr-category-configuration-data", dataType: "json", success: function (response){ // console.log(response.all_categories); $.each(response.all_categories, function (key, item) { $(‘tbody’).append(‘<tr> <td>’+item.category_name+'</td> <td>’+item.category_name+'</td> <td>’+item.category_name+'</td> <td>’+item.category_name+'</td> </tr>’); }); } }); } Controller: (tabled ..

Read more

I have the following HTML : <div class="row"> <div class="col-12"> <div class="card mb-4"> <div class="card-body"> <h5 class="mb-4">Projet</h5> <form id="projetform" method="post" action="ajout_projet" class="myForms" enctype="multipart/form-data"> {{ csrf_field() }} <input type="hidden" id="id_hidden" name="id_projet" /> <div class="form-group"> <label for="inputAddress">Numéro de projet</label> <input type="text" class="form-control" id="numero_projet" name="numero_projet" placeholder="Description"> </div> <div class="form-row"> <div class="form-group col-md-6"> <label for="inputState">Client</label> <select id="id_client" class="form-control" name="id_client"> ..

Read more

I am trying to make a simple data filter in Laravel using jQuery AJAX. In my blade I am doing something like this. ***********collegelist.blade.php************ @foreach($results as $result) showing $result values @endforeach Ajax code $(‘.filter_type :checkbox’).on(‘change’,function() { if($(this).is(‘:checked’)){ var college_type=$(this).val(); alert(college_type); $.ajax({ url:’/collegeListing/public/collegeList/{college_type}/{city}’, type:’get’, data:{college_type:college_type,city:’All Cities’}, success(data){ return data; }, }); } }); And my controller ..

Read more

I’m trying to do a real-time search bar for my products list but I keep getting in my consol Uncaught ReferenceError: data is not defined at HTMLInputElement.<anonymous> (produits:243) at HTMLDocument.dispatch (jquery-2.2.4.min.js:3) at HTMLDocument.r.handle (jquery-2.2.4.min.js:3) I want to display the products without refreshing the page that’s why I used ajax, but since I only used it ..

Read more

I managed to dynamically add input fields using this code : My HTML : <div class="row"> <div class="col-12"> <div class="card mb-4 form_field_outer "> <div class="card-body form_field_outer_row "> <form> <div class="form-row"> <div class="form-group col-md-4"> <label for="inputState">Casting</label> <select id="id_casting" class="form-control" name="id_casting"> <option selected>Choose…</option> @foreach($castings as $casting) <option data-id="{{$casting->id_casting}}" value="{{$casting->id_casting}}">{{$casting->nom.’ ‘.$casting->prenom}}</option> @endforeach </select> </div> <div class="form-group col-md-4"> <label ..

Read more

I’m trying to pass a variable from Controller to blade view. So there is my Controller : public function index_ajout_projet() { $clients = Client::whereIn(‘id_filiale’,[0, Auth::user()->id_filiale])->get(); $agences_conseil = AgenceConseil::all(); $agences_casting = Agence_Casting::all(); return view(‘Projet.ajout_projet’, [ ‘clients’ => $clients ],[ ‘agences_conseil’ => $agences_conseil ],[‘agences_casting’=>$agences_casting]); } There is my view : <div class="form-row"> <div class="form-group col-md-6"> <label for="inputState">Agence ..

Read more

I’m trying to add dynamically input fields using jquery. So I have the following code My HTML code : <div class="col-12 col-md-12 col-xl-8 col-left"> <div class="card mb-4 "> <div class="card-body "> <button type="button" class="btn btn-outline-primary mb-1 add_new_frm_field_btn">Ajouter un nouveau casting</button> </br> </br> <div class="row"> <div class="col-12"> <div class="card mb-4 form_field_outer "> <div class="card-body form_field_outer_row "> ..

Read more