logo
Tags down

shadow

Laravel - Jquery Dynamic Drop Down gives error 500 internal server error


By : Julius D'Souza
Date : October 17 2020, 08:10 AM
Any of those help The 500 error means that you have an error in your controller, put this into your JavaScript code:
code :
...
success:function(result)
{
    $('#'+dependent).html(result);
},
error: function(result) {
    console.log(result);
}
...


Share : facebook icon twitter icon

jquery autocomplete and laravel 5.1 throwing internal server error 500


By : Arun M
Date : March 29 2020, 07:55 AM
I wish this help you I'km trying the autocomplete by selecting data from DB and getting back the response as json but all I got is internal server error, could it be a problem of csrf token? , Problem was in getData function, this one works.
code :
public function getData(){

            $term = Input::get('term');

            $data = DB::table('items')->distinct()->select('item_name')->where('item_name', 'LIKE', $term.'%')->groupBy('item_name')->take(10)->get();
            foreach ($data as $v) {
                $return_array[] = array('value' => $v->item_name);
            }

            return Response::json($return_array);


    }

JQuery Ajax Post results in 500 Internal Server Error (using Laravel 5.1)


By : SteveoOn
Date : March 29 2020, 07:55 AM
will help you I finally figured out why it errors. I did not include the namespace of the model that I used which is UserShow. When I added the namespace it worked! This is the line I added use App\UserShow; . Thank you so much @Jay Blanchard for your quick response.

500 internal server error using jquery and ajax in laravel 5.2


By : Istiaque Siddiqi
Date : March 29 2020, 07:55 AM
I wish did fix the issue. It seems like you have problems with our csrf token. Before making your ajax calls just change your ajax setup and put the token in every header you sent via ajax. This should fix your error.
First add a meta tag
code :
<meta name="_token" content="{{ csrf_token() }}">
$(function () {
    $.ajaxSetup({
        headers: { 'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content') }
    });
});
$.ajaxSetup({ headers: { 'csrftoken' : '{{ csrf_token() }}' } });

Laravel 5.3 - jquery ajax (internal server error 500)


By : Quaintrovert
Date : March 29 2020, 07:55 AM
I wish this helpful for you First the _token should be always sent in the http request so you could just add it to the data :
code :
$('.takImg').click(function(){
    var photoId = $(this).parent().attr('id');
    var _token = $('meta[name="csrf_token"]').attr('content');

    $.ajax({
        type: "POST",
        url: "/save_like",
        data: {_token:_token, photoId:photoId},
        success : function(msg) {
            console.log(msg);
        },
        complete : function(r) {
            console.log(r);
        },
        error: function(error) {
            console.log(error);
        }
    }); 
}); 
DB::update('UPDATE `photo_links` SET likes = likes + 1 WHERE `id` = ?', array($photoId));
____________________________________________________________^^^^^^^^^^
public function saveLike(){
    $photoId = INPUT::get('photoId');

    DB::update("UPDATE `photo_links` SET likes=likes+1 WHERE `id` = $photoId");
}

jquery send data perfectly but says internal server error 500 in laravel


By : Lenni
Date : March 29 2020, 07:55 AM
wish helps you I have solved the issue. Problem was with Response facade. I forgot to add this in my controller. After seeing @tudor comment I have checked my error log and found this error. Then I have used use Response; in my controller. Now Problem is solved.
shadow
Privacy Policy - Terms - Contact Us © voile276.org