Category : ajax

My Laravel API is hosted on godaddy and I am call that API from localhost. Here is $.ajax({ url: ‘https://example.com/api/ali’, method: ‘POST’, data: { image: dataURL, patientname: $(‘.patientname’).attr(‘patientname’), phone: phonenum, mrid: $(‘.patientmrid’).attr(‘mrid’), }, success: function(response) { $(".btnsave").text(‘Send message’); if(response == "success"){ $(‘.alert-success’).fadeIn(300).delay(5000).fadeOut(1000); }else if(response == "notsaved"){ $(‘.alert-danger’).fadeIn(300).delay(5000).fadeOut(1000); }else if(response == "notsent"){ $(‘.alert-danger’).fadeIn(300).delay(50000).fadeOut(1000); } }, error: ..

Read more

When I drop the images to the dropzone area it’s not uploading and gives me error "Failed to load resource: the server responded with a status of 500 (Internal Server Error)" Picture over here enter image description here I’m using Laravel 8 and Dropzone 5.9.2 In ArticleController public function imageUpload(Request $request) { $secretCode = $request->input(‘secretCode’); ..

Read more

I tried to add csrf using ajax,csrf token mismatch error `$.ajax({ headers: { ‘X-CSRF-TOKEN’: $(‘meta[name="csrf-token"]’).attr(‘content’) }});` <meta name="csrf-token" content="{{ csrf_token() }}"> tried @csrf in form {{ csrf_field() }} Web img1 Cookie img2 My laravel version is Laravel Framework 6.20.44 I wasted so many days on this then I posted here, my be I get fired ..

Read more

submitting a dynamic form but can’t store the value to database. im a beginner i stuck for 2,3 days but cant solve the problem. the request value is like {"_token":"PTGmyf3UZrD1TgKDJcREcKia9VFRLYaP5kNaAkAU","id":["28","31"],"name":["Fogg","zack"],"rate":["70","5000"],"quantity":["1","1"],"submit":"Submit"} <form name="" id="form" action="{{ url(‘/store_order_item’) }}" method="POST"> @csrf <table class="table table-bordered" id="dynamic_field"> <thead> <tr> <th>Product Id</th> <th>Name</th> <th>Rate</th> <th>Quantity</th> <th>Amount</th> <th>Action</th> </tr> </thead> <tbody> </tbody> ..

Read more

I update the database with jquery ajax and print "success/failure" with alert according to the return value. The product update is successful, but the message "failed" appears on the screen and I get the error "The PUT method is not supported for this route". My jquery: $(‘#policies_button’).on(‘click’, function () { $(‘#ShiftAddModal’).modal(‘hide’); var id = $(‘#select_policies’).val(); ..

Read more

I make CRUD operation by using laravel, ajax and the blade form is (modal), the (create method) works fine, but the (update method) doesn’t work, in spite of its functionality is the same of (update method) I Think the issue is: the form kyes (name atrribute) doesn’t send to the controller, In spite of the ..

Read more

I’m using Laravel with Chromelogger to log messages to the console in DevTools. I added this in config/logging.php: ‘chrome’ => [ ‘driver’ => ‘monolog’, ‘handler’ => MonologHandlerChromePHPHandler::class, ‘formatter’ => MonologFormatterChromePHPFormatter::class ], and set this in the .env file LOG_CHANNEL=chrome and use it like this in a controller or model : use IlluminateSupportFacadesLog; Log::info(‘This is a ..

Read more

I’m not really good at ajax. I want to uncheck the checkbox for the ‘active’ users. I have this in my LoginController public function login() { $credentials = $this->validate(request(), [ ’email’ => ’email|required|string’, ‘password’ => ‘required|string’, ]); if (Auth::attempt($credentials)) { //auth attemptdevuelve verdadero o falso en caso de que las credenciales correspondan o no //Inician ..

Read more

I’m not really good at ajax. I want to uncheck the checkbox for the ‘active’ users. I have this in my LoginController public function login() { $credentials = $this->validate(request(), [ ’email’ => ’email|required|string’, ‘password’ => ‘required|string’, ]); if (Auth::attempt($credentials)) { //auth attemptdevuelve verdadero o falso en caso de que las credenciales correspondan o no //Inician ..

Read more

This is my Ajax Query function updateTask() { var task_id = document.getElementById(‘edit’).getAttribute(‘edit_task_id’); var newTask = document.getElementById(‘edit_task’).value; var csrf = document.querySelector(‘meta[name="csrf-token"]’).content; var close = document.getElementById(‘close’); var editob = new XMLHttpRequest(); editob.open(‘POST’, ‘/{task_id}/{newTask}’, true); editob.setRequestHeader(‘X-CSRF-Token’, csrf); editob.setRequestHeader(‘Content-type’, ‘application/x-www-form-urlencoded’); editob.send("task_id=" + task_id, "newTask=" + newTask); console.log(newTask); console.log(task_id); } This is y Controller public function editTask($id, $newTask){ //$x = ..

Read more

I have a pagination and try to limit the amount of pages for that pagination. Every page has 50 results and the maximum amount of pages I want for this pagination is 200 (10k total entries from the table). I tried the following: $page_count = 50; $users = DB::Table(‘user_totalpoints’)->where(‘points’, ‘>’, 0) ->orderBy(‘points’, ‘desc’) ->orderBy(‘id’, ‘asc’) ..

Read more

I am new to Laravel. Trying to Pass ID from View to Controller but getting Error POST http://127.0.0.1:8000/getbuffaloidformonitor 404 (Not Found) This is my View BuffaloMonitor : $(document).on(‘click’, ‘.viewmonitormodal’, function() { var modal_data = $(this).data(‘info’).split(‘,’); $(‘#viewbuffaloID’).val(modal_data[1]); var buffaloid = document.getElementById(‘viewbuffaloID’).value// get buffalo id from textbox to get data for that ID alert(buffaloid); //alert(data); $(function() { ..

Read more

We are using Laravel 8 for ecommerce. The built in search queries in Product categories, tags, product name, sku and brands. And its buffering so much for result to be appeared. And after appearing the result its being querying again automatically. And search result does not stay, if I put a space after search keyword ..

Read more

We are using Laravel 8 for ecommerce. The built in search queries in Product categories, tags, product name, sku and brands. And its buffering so much for result to be appeared. And after appearing the result its being querying again automatically. And search result does not stay, if I put a space after search keyword ..

Read more

I want to show the updated comment after edit. but I cant show it without refreshing the page. i want to show it without refreshing the page. i am doing it with ajax. i cant fetch all the comments after doing an update operation. i didn’t understand the fetch operation of this code… that is ..

Read more

after uploading to the host I get this message when I try to change something in the database via ajax knowing that it is working well in localhost "message": "CSRF token mismatch.", "exception": "SymfonyComponentHttpKernelExceptionHttpException", "file": "/hermes/bosnacweb08/bosnacweb08ab/b1283/ipg.nmedcure47094/proxima/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php", here is my ajax code $.ajax({ url: ‘{{ url(‘appointment’) }}/update_status_doctor/’ + appointment_id, type: "PATCH", data: { ‘_token’: "{{ csrf_token() ..

Read more

I am getting this error when I try to update any city through ajax. I am unable to pass "ID" as it doesn’t reflects in payload . Here is my ajax function function editCityDetails(city_id) { $.ajax({ type:’GET’, url:"/admin/editCity/" + city_id, success:function(response){ if(response.success){ var str = ”; $.each(response.data, function(k,v) { str += ‘<form class="form" id="jquery-val-form" method="post" ..

Read more