Category : ajax

I’m trying to generate a word document using Laravel8. So I’m using the following controller to generate the document and save it on a public_path, And then download this file from the public_path. public function generer(Request $request){ $projets_casting= Projet_Casting::whereIn(‘id_contrat’,explode(",", $request->selectedvalues))->where(‘id_projet’,$request->id_projet) ->get(); foreach ($projets_casting as $projet_casting) { $id_modele_contrat = Contrat::where(‘id_contrat’,$projet_casting->id_contrat)->value(‘id_modele_contrat’); $model_file = Model_Contrat::where(‘id_modele_contrat’,$id_modele_contrat)->value(‘fichier’); $castings = Casting::where(‘id_casting’,$projet_casting->id_casting); ..

Read more

Each group has several subgroups. I have a filters table. public function up() { Schema::create(‘filters’, function (Blueprint $table) { $table->id(); $table->foreignId(‘category_id’)->constrained()->cascadeOnDelete(); $table->integer(‘parent_id’); $table->string(‘name’)->nullable(); $table->string(‘latin’)->nullable(); $table->smallInteger(‘field’)->nullable(); $table->string(‘checkbox_name’)->nullable(); $table->string(‘color_name’)->nullable(); $table->string(‘color_code’)->nullable(); $table->timestamps(); }); } And I have filters form like this. How to save checkbox_name, and color_name and color_code. public function store(Request $request) { $filters = collect([]); if ..

Read more

Each group has several subgroups. I have a filters table. public function up() { Schema::create(‘filters’, function (Blueprint $table) { $table->id(); $table->foreignId(‘category_id’)->constrained()->cascadeOnDelete(); $table->integer(‘parent_id’); $table->string(‘name’)->nullable(); $table->string(‘latin’)->nullable(); $table->smallInteger(‘field’)->nullable(); $table->string(‘checkbox_name’)->nullable(); $table->string(‘color_name’)->nullable(); $table->string(‘color_code’)->nullable(); $table->timestamps(); }); } And I have filters form like this. How to save checkbox_name, and color_name and color_code. public function store(Request $request) { $filters = collect([]); if ..

Read more

i made products and categories and sub categories when i do sync them , product and category save in the category_prodcts. but sub category shows a error message : SQLSTATE[HY000]: General error: 1364 Field ‘subcategory_id’ doesn’t have a default value (SQL: insert into `category_products` (`category_id`, `product_id`) values (1, 1)) and these are my codes : ..

Read more

i want to make a statement if is_participant is one then check the box, but i tried but it doesn’t work $user = User::with(‘regency.province’); return DataTables::of($user) ->editColumn(‘is_participant’, function ($user) { return ‘<input ‘ . $user->is_participant == 1 ? "checked" : "" . ‘ type="checkbox" id="’ . $user->id . ‘">’; }) is there something missing in ..

Read more

So the thing is when I click on the button, it will call an ajax function which will direct to controller file and store the data in FollowupTreatment variable, but in view file it isn’t printing data and just print N/A So here is the button <tr> <th scope="row"> <a role="button" style="text-decoration:underline;" data-toggle="modal" data-target="#summaryModal" onClick="fetchSummary({{$eachPatient->IdPatient}})"> ..

Read more

I am using Laravel-8. I want to edit my dropdown list. When I click on the Edit button I can not set the specific value into the dropdown / select option field using Ajax. Please help me. My Dropdown Code: <div class="ibox-content"> <input type="hidden" id="area_id"> <div class="form-group row"> <label class="col-lg-3 col-form-label">Select City</label> <div class="col-lg-9"> <select ..

Read more

This is my code ajax that send the DATA $.ajax({ url: ‘{{url("path")}}’, data: aux, type: ‘POST’, success:function(response){ console.log(response); }, error: function(response) { console.log("error"); } }); The problem is when i want manipulate this $request in my controller to create a new object with the datas that goes in the data. this is my controller en ..

Read more

All of my var statements uses identifiers: let count = document.getElementsByClassName(‘product_filter_div’).length + 1; let id1 = "’"+’filter_div-‘+count+"’"; let id2 = count; let id3 = ‘filter-‘+count; let html = ‘<div id="filter_div-‘+count+’" class="product_filter_div position-relative">’+ So why am I getting a null error? And in my browsers Firefox and Chrome I don’t get any errors or warnings. When ..

Read more

All of my var statements uses identifiers: let count = document.getElementsByClassName(‘product_filter_div’).length + 1; let id1 = "’"+’filter_div-‘+count+"’"; let id2 = count; let id3 = ‘filter-‘+count; let html = ‘<div id="filter_div-‘+count+’" class="product_filter_div position-relative">’+ So why am I getting a null error? I ran this code in the Javascript runner and got the null error message. And ..

Read more

I have a data, when I update the data (using modal), select option work correctly When I close the modal, and I click the edit button again, something wrong with select option: This is my edit modal ajax: // Function for edit modal plan schedule $(‘body’).on(‘click’, ‘.editPlanSchedule’, function() { var Item_id = $(this).data(‘id’); $.get("/quotation/getEditPlanSchedule" + ..

Read more

I’ve in my React component this function: const url = ‘/category’; function hideOnClick(id) { setHide({value: id}) console.log(id); const body = { ‘chordId’ : id, } const requestMetadata = { method: ‘POST’, headers: { ‘Content-Type’: ‘application/json’ }, body: JSON.stringify(body) }; console.log(body); fetch(url, requestMetadata) .then(res => res.json()) .then(res => { this.setState({ url: res }) console.log(res); }) } ..

Read more

I have dropdown like this: <div class="row"> <div class="col-md-12 col-sm-6"> <div class="form-group"> <label for="">{{ __(‘Product Plan’) }}<span class="required"></span></label> <select name="product_plan" class="form-control" id="product_plan" style="width: 50%"> @foreach ($product_plan as $val) <option value="{{ $val->productplanID }}"> {{ $val->productplanID }}</option> @endforeach </select> </div> </div> </div> I using modal to update this data, so I use AJAX. This is my ajax ..

Read more

I have a View to display a menu of categories and its products based on the authenticated user, which means I only want certain categories/products displayed, my problem is in the search bar when I type all products show from all categories but I want the search to only find products in those certain categories. ..

Read more

I’m sending data with a ajax call to my laravel server at http://127.0.0.1:8000/data Laravel Route Route::post(‘/data’,[MainController::class, ‘data’]); my modle public function up() { Schema::create(‘names’, function (Blueprint $table) { $table->id(); $table->string(‘name’); $table->timestamps(); }); } Controller function data(Request $request) { $requestPayload = file_get_contents("php://input"); $object = json_decode($requestPayload); return ($object); } Json data i want to save in database ..

Read more

although I am providing url with https , it’s kept saying the following error : my codes from script : $.ajax({ url: "https://www.aspireelearning.com/api/summitRegistration", type:"POST", data:{ full_name:full_name,email:email, phone:phone, country:country, organization:organization, profession : profession, check_conditions : check_conditions }, success:function(data){ if($.isEmptyObject(data.error)){ $("#registration_error").removeClass(‘colorRed’); $(‘#check_conditions’).removeClass(‘checkboxBorder’); $("#registration_error").text(data.success).addClass(‘colorGreen’); getRegistrationNumber(); }else{ $(‘#registration_error’).addClass(‘colorGreen’); $(‘#registration_error’).text(data.error).addClass(‘colorRed’); $(‘#check_conditions’).text(data.error).addClass(‘checkboxBorder’); getRegistrationNumber(); } }, }); }); middleware cors.php : Source: ..

Read more

I have a chat application created in laravel and websockets, I am using Laravel echo to listen to the chat channel. this is an ajax call to send message: var data = { "_token": ‘{{csrf_token()}}’, "from_user": ‘{{ Auth::user()->id }}’, "chat_id": chat_id, "to_user": to_user, "message": message }; $.ajax({ method: "POST", data: data, url: $url, }).done(function( msg ..

Read more