skip to Main Content

Handle Laravel 404 or 500 error in jQuery AJAX

I'm currently stuck on an issue where I'm unable to handle 404 or 500 error with jQuery AJAX. I'm fetching some data from controller, and I'm returning json() with relevant status code: public function getFilteredProducts(Request $request){ $products = Product::where('product_category_id', $request->category_id)->get();…

VIEW QUESTION

JQuery AJAX Post data undefined barebones example

HTML: <html> <head> <title>Page Title</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script src="script.js"></script> </head> <body> <button onclick="Posty()">click</button> <p id="result"></p> </body> </html> script.js: function Posty() { var pointless = "i am indeed"; $.post("server.php", pointless, PostyReturned()); } function PostyReturned(data) { var output = document.getElementById("result"); output.innerHTML =…

VIEW QUESTION

use laravel foreach for send with ajax request – Jquery ajax

i want to use foreach id to send via ajax request. @foreach ($AssetsGroup as $AssetGroup) <tr> ... <td> <button id="btn_add{{ $AssetGroup->id }}" data-asset-group-id="{{ $AssetGroup->id }}">افزودن دارایی</button> </td> .... </tr> @endforeach ajax request $(document).on('click','#btn-save',function(){ var formDatas = { name: $('#name2').val(), group:…

VIEW QUESTION
Back To Top
Search