JQuery not responding to a POST request












1















i'm working with Laravel and JQuery, I've set up a form and the controller instructions for it to store information in the database, now the problem is that after being all set up when i click the "submit" button, nothing happens, i always keep the console open to check for errors and to see the requests, but now it's not doing anything.



Here is the code:



On the header i added this:



<script src="http://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous">
</script>


my form looks like this:



<form id="myForm">
<div class="form-group label-floating">
<label class="control-label" style="margin-top: -5px;">Title</label>
<input class="form-control" id="title" type="text" required="">
</div>
<div class="form-group label-floating">
<label class="control-label" style="margin-top: -5px;">Summary</label>
<textarea id="summary" class="form-control" required=""></textarea>
</div>
<div class="form-group label-floating">
<label class="control-label" style="margin-top: -5px;">Description</label>
<textarea id="description" class="form-control" required=""></textarea>
</div>
<div class="form-group label-floating">
<label class="control-label" style="margin-top: -5px;">Link to media (optional)</label>
<input id="medialink" class="form-control" type="text" required="">
</div>
<div class="col-lg-12 col-md-6 col-sm-12 col-xs-12">
<button class="btn btn-primary btn-lg full-width" type="button" id="ajaxSubmit">Submit</button>
</div>
</form>


and the controller looks like this:



public function submitit($id, Request $request)
{
$bounty = Bounty::where('id', $id)->first();
$vulnerability = new Vulnerability();
$vulnerability->title = $request->title;
$vulnerability->summary = $request->summary;
$vulnerability->description = $request->description;
$vulnerability->medialink = $request->media;
$vulnerability->save();
Toastr::success('Successfuly submitted', 'Congratulations!', ['toast-top-right']);
return response()->json(['success'=>'Submitted correctly']);
}


Ajax:



<script type="text/javascript">

jQuery(document).ready(function(){
jQuery('#ajaxSubmit').click(function(e){
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content')
}
});
jQuery.ajax({
url: "{{ url('/submitit/' . $bounty->id . '/' . $bounty->company_identifier) }}",
method: 'post',
data: {
_token: '{{csrf_token()}}',
title: jQuery('#title').val(),
summary: jQuery('#summary').val(),
description: jQuery('#description').val(),
medialink: jQuery('#medialink').val()
},
success: function(result){
console.log(result);
}});
});
});

</script>


in my route i got:



Route::post('/submitit/{id}', [

'uses' => 'BountyController@submitit',

])->middleware('auth');


What's going on? why is it not sending any request?










share|improve this question




















  • 1





    Show us jquery (Ajax) code of submitting the form plz.

    – ako
    Nov 18 '18 at 23:05











  • Sorry, just added it :)

    – Daniel Logvin
    Nov 18 '18 at 23:09











  • Have you tried calling the post method using postman or curl?

    – Jules
    Nov 18 '18 at 23:17











  • Try to add console.log('something') before the $.ajaxSetup({ row and click the button to see, whether the click-event is fired.

    – Martin Heralecký
    Nov 18 '18 at 23:26











  • Add some error handling and inspect the xhr object for clues. Or inspect actual request in browser dev tools network. And you can't send anything else other than json. Get rid of the server side Toastr

    – charlietfl
    Nov 18 '18 at 23:41


















1















i'm working with Laravel and JQuery, I've set up a form and the controller instructions for it to store information in the database, now the problem is that after being all set up when i click the "submit" button, nothing happens, i always keep the console open to check for errors and to see the requests, but now it's not doing anything.



Here is the code:



On the header i added this:



<script src="http://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous">
</script>


my form looks like this:



<form id="myForm">
<div class="form-group label-floating">
<label class="control-label" style="margin-top: -5px;">Title</label>
<input class="form-control" id="title" type="text" required="">
</div>
<div class="form-group label-floating">
<label class="control-label" style="margin-top: -5px;">Summary</label>
<textarea id="summary" class="form-control" required=""></textarea>
</div>
<div class="form-group label-floating">
<label class="control-label" style="margin-top: -5px;">Description</label>
<textarea id="description" class="form-control" required=""></textarea>
</div>
<div class="form-group label-floating">
<label class="control-label" style="margin-top: -5px;">Link to media (optional)</label>
<input id="medialink" class="form-control" type="text" required="">
</div>
<div class="col-lg-12 col-md-6 col-sm-12 col-xs-12">
<button class="btn btn-primary btn-lg full-width" type="button" id="ajaxSubmit">Submit</button>
</div>
</form>


and the controller looks like this:



public function submitit($id, Request $request)
{
$bounty = Bounty::where('id', $id)->first();
$vulnerability = new Vulnerability();
$vulnerability->title = $request->title;
$vulnerability->summary = $request->summary;
$vulnerability->description = $request->description;
$vulnerability->medialink = $request->media;
$vulnerability->save();
Toastr::success('Successfuly submitted', 'Congratulations!', ['toast-top-right']);
return response()->json(['success'=>'Submitted correctly']);
}


Ajax:



<script type="text/javascript">

jQuery(document).ready(function(){
jQuery('#ajaxSubmit').click(function(e){
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content')
}
});
jQuery.ajax({
url: "{{ url('/submitit/' . $bounty->id . '/' . $bounty->company_identifier) }}",
method: 'post',
data: {
_token: '{{csrf_token()}}',
title: jQuery('#title').val(),
summary: jQuery('#summary').val(),
description: jQuery('#description').val(),
medialink: jQuery('#medialink').val()
},
success: function(result){
console.log(result);
}});
});
});

</script>


in my route i got:



Route::post('/submitit/{id}', [

'uses' => 'BountyController@submitit',

])->middleware('auth');


What's going on? why is it not sending any request?










share|improve this question




















  • 1





    Show us jquery (Ajax) code of submitting the form plz.

    – ako
    Nov 18 '18 at 23:05











  • Sorry, just added it :)

    – Daniel Logvin
    Nov 18 '18 at 23:09











  • Have you tried calling the post method using postman or curl?

    – Jules
    Nov 18 '18 at 23:17











  • Try to add console.log('something') before the $.ajaxSetup({ row and click the button to see, whether the click-event is fired.

    – Martin Heralecký
    Nov 18 '18 at 23:26











  • Add some error handling and inspect the xhr object for clues. Or inspect actual request in browser dev tools network. And you can't send anything else other than json. Get rid of the server side Toastr

    – charlietfl
    Nov 18 '18 at 23:41
















1












1








1








i'm working with Laravel and JQuery, I've set up a form and the controller instructions for it to store information in the database, now the problem is that after being all set up when i click the "submit" button, nothing happens, i always keep the console open to check for errors and to see the requests, but now it's not doing anything.



Here is the code:



On the header i added this:



<script src="http://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous">
</script>


my form looks like this:



<form id="myForm">
<div class="form-group label-floating">
<label class="control-label" style="margin-top: -5px;">Title</label>
<input class="form-control" id="title" type="text" required="">
</div>
<div class="form-group label-floating">
<label class="control-label" style="margin-top: -5px;">Summary</label>
<textarea id="summary" class="form-control" required=""></textarea>
</div>
<div class="form-group label-floating">
<label class="control-label" style="margin-top: -5px;">Description</label>
<textarea id="description" class="form-control" required=""></textarea>
</div>
<div class="form-group label-floating">
<label class="control-label" style="margin-top: -5px;">Link to media (optional)</label>
<input id="medialink" class="form-control" type="text" required="">
</div>
<div class="col-lg-12 col-md-6 col-sm-12 col-xs-12">
<button class="btn btn-primary btn-lg full-width" type="button" id="ajaxSubmit">Submit</button>
</div>
</form>


and the controller looks like this:



public function submitit($id, Request $request)
{
$bounty = Bounty::where('id', $id)->first();
$vulnerability = new Vulnerability();
$vulnerability->title = $request->title;
$vulnerability->summary = $request->summary;
$vulnerability->description = $request->description;
$vulnerability->medialink = $request->media;
$vulnerability->save();
Toastr::success('Successfuly submitted', 'Congratulations!', ['toast-top-right']);
return response()->json(['success'=>'Submitted correctly']);
}


Ajax:



<script type="text/javascript">

jQuery(document).ready(function(){
jQuery('#ajaxSubmit').click(function(e){
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content')
}
});
jQuery.ajax({
url: "{{ url('/submitit/' . $bounty->id . '/' . $bounty->company_identifier) }}",
method: 'post',
data: {
_token: '{{csrf_token()}}',
title: jQuery('#title').val(),
summary: jQuery('#summary').val(),
description: jQuery('#description').val(),
medialink: jQuery('#medialink').val()
},
success: function(result){
console.log(result);
}});
});
});

</script>


in my route i got:



Route::post('/submitit/{id}', [

'uses' => 'BountyController@submitit',

])->middleware('auth');


What's going on? why is it not sending any request?










share|improve this question
















i'm working with Laravel and JQuery, I've set up a form and the controller instructions for it to store information in the database, now the problem is that after being all set up when i click the "submit" button, nothing happens, i always keep the console open to check for errors and to see the requests, but now it's not doing anything.



Here is the code:



On the header i added this:



<script src="http://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous">
</script>


my form looks like this:



<form id="myForm">
<div class="form-group label-floating">
<label class="control-label" style="margin-top: -5px;">Title</label>
<input class="form-control" id="title" type="text" required="">
</div>
<div class="form-group label-floating">
<label class="control-label" style="margin-top: -5px;">Summary</label>
<textarea id="summary" class="form-control" required=""></textarea>
</div>
<div class="form-group label-floating">
<label class="control-label" style="margin-top: -5px;">Description</label>
<textarea id="description" class="form-control" required=""></textarea>
</div>
<div class="form-group label-floating">
<label class="control-label" style="margin-top: -5px;">Link to media (optional)</label>
<input id="medialink" class="form-control" type="text" required="">
</div>
<div class="col-lg-12 col-md-6 col-sm-12 col-xs-12">
<button class="btn btn-primary btn-lg full-width" type="button" id="ajaxSubmit">Submit</button>
</div>
</form>


and the controller looks like this:



public function submitit($id, Request $request)
{
$bounty = Bounty::where('id', $id)->first();
$vulnerability = new Vulnerability();
$vulnerability->title = $request->title;
$vulnerability->summary = $request->summary;
$vulnerability->description = $request->description;
$vulnerability->medialink = $request->media;
$vulnerability->save();
Toastr::success('Successfuly submitted', 'Congratulations!', ['toast-top-right']);
return response()->json(['success'=>'Submitted correctly']);
}


Ajax:



<script type="text/javascript">

jQuery(document).ready(function(){
jQuery('#ajaxSubmit').click(function(e){
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content')
}
});
jQuery.ajax({
url: "{{ url('/submitit/' . $bounty->id . '/' . $bounty->company_identifier) }}",
method: 'post',
data: {
_token: '{{csrf_token()}}',
title: jQuery('#title').val(),
summary: jQuery('#summary').val(),
description: jQuery('#description').val(),
medialink: jQuery('#medialink').val()
},
success: function(result){
console.log(result);
}});
});
});

</script>


in my route i got:



Route::post('/submitit/{id}', [

'uses' => 'BountyController@submitit',

])->middleware('auth');


What's going on? why is it not sending any request?







jquery laravel






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 18 '18 at 23:58







Daniel Logvin

















asked Nov 18 '18 at 22:59









Daniel LogvinDaniel Logvin

4711




4711








  • 1





    Show us jquery (Ajax) code of submitting the form plz.

    – ako
    Nov 18 '18 at 23:05











  • Sorry, just added it :)

    – Daniel Logvin
    Nov 18 '18 at 23:09











  • Have you tried calling the post method using postman or curl?

    – Jules
    Nov 18 '18 at 23:17











  • Try to add console.log('something') before the $.ajaxSetup({ row and click the button to see, whether the click-event is fired.

    – Martin Heralecký
    Nov 18 '18 at 23:26











  • Add some error handling and inspect the xhr object for clues. Or inspect actual request in browser dev tools network. And you can't send anything else other than json. Get rid of the server side Toastr

    – charlietfl
    Nov 18 '18 at 23:41
















  • 1





    Show us jquery (Ajax) code of submitting the form plz.

    – ako
    Nov 18 '18 at 23:05











  • Sorry, just added it :)

    – Daniel Logvin
    Nov 18 '18 at 23:09











  • Have you tried calling the post method using postman or curl?

    – Jules
    Nov 18 '18 at 23:17











  • Try to add console.log('something') before the $.ajaxSetup({ row and click the button to see, whether the click-event is fired.

    – Martin Heralecký
    Nov 18 '18 at 23:26











  • Add some error handling and inspect the xhr object for clues. Or inspect actual request in browser dev tools network. And you can't send anything else other than json. Get rid of the server side Toastr

    – charlietfl
    Nov 18 '18 at 23:41










1




1





Show us jquery (Ajax) code of submitting the form plz.

– ako
Nov 18 '18 at 23:05





Show us jquery (Ajax) code of submitting the form plz.

– ako
Nov 18 '18 at 23:05













Sorry, just added it :)

– Daniel Logvin
Nov 18 '18 at 23:09





Sorry, just added it :)

– Daniel Logvin
Nov 18 '18 at 23:09













Have you tried calling the post method using postman or curl?

– Jules
Nov 18 '18 at 23:17





Have you tried calling the post method using postman or curl?

– Jules
Nov 18 '18 at 23:17













Try to add console.log('something') before the $.ajaxSetup({ row and click the button to see, whether the click-event is fired.

– Martin Heralecký
Nov 18 '18 at 23:26





Try to add console.log('something') before the $.ajaxSetup({ row and click the button to see, whether the click-event is fired.

– Martin Heralecký
Nov 18 '18 at 23:26













Add some error handling and inspect the xhr object for clues. Or inspect actual request in browser dev tools network. And you can't send anything else other than json. Get rid of the server side Toastr

– charlietfl
Nov 18 '18 at 23:41







Add some error handling and inspect the xhr object for clues. Or inspect actual request in browser dev tools network. And you can't send anything else other than json. Get rid of the server side Toastr

– charlietfl
Nov 18 '18 at 23:41














4 Answers
4






active

oldest

votes


















0














Found the solution, i did not notice that the route on the ajax was not matching the one in the web.php file.



solution was to change this: url: "{{ url('/submitit/' . $bounty->id . '/' . $bounty->company_identifier) }}",



to this: url: "{{ url('/submitit/' . $bounty->id) }}",






share|improve this answer































    0














    You change url



     url: "{{ url('/submitit/' . $bounty->id . '/' . $bounty->company_identifier) }}",


    to



     url: "{{ action('BountyController@submitit', ['id' => $bounty->id]) }}",


    and then you dump in Controller or F12 open tab Network see request send






    share|improve this answer































      0















       jquery ajax 
      url: "{{ url('/submitit/' . $bounty->id . '/' . $bounty->company_identifier) }}"



         write In route url like

      Route::post('/submitit/{id}/{company_identifier}',
      'BountyController@submitit')->middleware('auth');





      share|improve this answer































        -2














        Try using Type instead of method in ajax setting object.



        More on the answer:
        As you are setting



        $.ajaxSetup({
        headers: {
        'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content')
        }


        You don't need _token in your data field.
        Try to add this section to your ajax setting object so that you can see if there is any error response.



        error: function (res) {
        console.log(res);
        }





        share|improve this answer


























        • still does not do anything

          – Daniel Logvin
          Nov 18 '18 at 23:15











        • @DanielLogvin See new edition of the answer.

          – ako
          Nov 18 '18 at 23:19











        • _token may not be necessary, but it doesn't answer the question.

          – Martin Heralecký
          Nov 18 '18 at 23:23











        • @DanielLogvin First, see if click event is triggered or not by putting a consle.log('test'); inside click event of the element.

          – ako
          Nov 18 '18 at 23:25













        • in what part of the code @ako?

          – Daniel Logvin
          Nov 18 '18 at 23:53











        Your Answer






        StackExchange.ifUsing("editor", function () {
        StackExchange.using("externalEditor", function () {
        StackExchange.using("snippets", function () {
        StackExchange.snippets.init();
        });
        });
        }, "code-snippets");

        StackExchange.ready(function() {
        var channelOptions = {
        tags: "".split(" "),
        id: "1"
        };
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function() {
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled) {
        StackExchange.using("snippets", function() {
        createEditor();
        });
        }
        else {
        createEditor();
        }
        });

        function createEditor() {
        StackExchange.prepareEditor({
        heartbeatType: 'answer',
        autoActivateHeartbeat: false,
        convertImagesToLinks: true,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: 10,
        bindNavPrevention: true,
        postfix: "",
        imageUploader: {
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        },
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        });


        }
        });














        draft saved

        draft discarded


















        StackExchange.ready(
        function () {
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53366289%2fjquery-not-responding-to-a-post-request%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown

























        4 Answers
        4






        active

        oldest

        votes








        4 Answers
        4






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        0














        Found the solution, i did not notice that the route on the ajax was not matching the one in the web.php file.



        solution was to change this: url: "{{ url('/submitit/' . $bounty->id . '/' . $bounty->company_identifier) }}",



        to this: url: "{{ url('/submitit/' . $bounty->id) }}",






        share|improve this answer




























          0














          Found the solution, i did not notice that the route on the ajax was not matching the one in the web.php file.



          solution was to change this: url: "{{ url('/submitit/' . $bounty->id . '/' . $bounty->company_identifier) }}",



          to this: url: "{{ url('/submitit/' . $bounty->id) }}",






          share|improve this answer


























            0












            0








            0







            Found the solution, i did not notice that the route on the ajax was not matching the one in the web.php file.



            solution was to change this: url: "{{ url('/submitit/' . $bounty->id . '/' . $bounty->company_identifier) }}",



            to this: url: "{{ url('/submitit/' . $bounty->id) }}",






            share|improve this answer













            Found the solution, i did not notice that the route on the ajax was not matching the one in the web.php file.



            solution was to change this: url: "{{ url('/submitit/' . $bounty->id . '/' . $bounty->company_identifier) }}",



            to this: url: "{{ url('/submitit/' . $bounty->id) }}",







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 19 '18 at 0:01









            Daniel LogvinDaniel Logvin

            4711




            4711

























                0














                You change url



                 url: "{{ url('/submitit/' . $bounty->id . '/' . $bounty->company_identifier) }}",


                to



                 url: "{{ action('BountyController@submitit', ['id' => $bounty->id]) }}",


                and then you dump in Controller or F12 open tab Network see request send






                share|improve this answer




























                  0














                  You change url



                   url: "{{ url('/submitit/' . $bounty->id . '/' . $bounty->company_identifier) }}",


                  to



                   url: "{{ action('BountyController@submitit', ['id' => $bounty->id]) }}",


                  and then you dump in Controller or F12 open tab Network see request send






                  share|improve this answer


























                    0












                    0








                    0







                    You change url



                     url: "{{ url('/submitit/' . $bounty->id . '/' . $bounty->company_identifier) }}",


                    to



                     url: "{{ action('BountyController@submitit', ['id' => $bounty->id]) }}",


                    and then you dump in Controller or F12 open tab Network see request send






                    share|improve this answer













                    You change url



                     url: "{{ url('/submitit/' . $bounty->id . '/' . $bounty->company_identifier) }}",


                    to



                     url: "{{ action('BountyController@submitit', ['id' => $bounty->id]) }}",


                    and then you dump in Controller or F12 open tab Network see request send







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Nov 19 '18 at 2:13









                    Tân NguyễnTân Nguyễn

                    1212




                    1212























                        0















                         jquery ajax 
                        url: "{{ url('/submitit/' . $bounty->id . '/' . $bounty->company_identifier) }}"



                           write In route url like

                        Route::post('/submitit/{id}/{company_identifier}',
                        'BountyController@submitit')->middleware('auth');





                        share|improve this answer




























                          0















                           jquery ajax 
                          url: "{{ url('/submitit/' . $bounty->id . '/' . $bounty->company_identifier) }}"



                             write In route url like

                          Route::post('/submitit/{id}/{company_identifier}',
                          'BountyController@submitit')->middleware('auth');





                          share|improve this answer


























                            0












                            0








                            0








                             jquery ajax 
                            url: "{{ url('/submitit/' . $bounty->id . '/' . $bounty->company_identifier) }}"



                               write In route url like

                            Route::post('/submitit/{id}/{company_identifier}',
                            'BountyController@submitit')->middleware('auth');





                            share|improve this answer














                             jquery ajax 
                            url: "{{ url('/submitit/' . $bounty->id . '/' . $bounty->company_identifier) }}"



                               write In route url like

                            Route::post('/submitit/{id}/{company_identifier}',
                            'BountyController@submitit')->middleware('auth');






                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Nov 19 '18 at 4:18









                            raushan kumarraushan kumar

                            6910




                            6910























                                -2














                                Try using Type instead of method in ajax setting object.



                                More on the answer:
                                As you are setting



                                $.ajaxSetup({
                                headers: {
                                'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content')
                                }


                                You don't need _token in your data field.
                                Try to add this section to your ajax setting object so that you can see if there is any error response.



                                error: function (res) {
                                console.log(res);
                                }





                                share|improve this answer


























                                • still does not do anything

                                  – Daniel Logvin
                                  Nov 18 '18 at 23:15











                                • @DanielLogvin See new edition of the answer.

                                  – ako
                                  Nov 18 '18 at 23:19











                                • _token may not be necessary, but it doesn't answer the question.

                                  – Martin Heralecký
                                  Nov 18 '18 at 23:23











                                • @DanielLogvin First, see if click event is triggered or not by putting a consle.log('test'); inside click event of the element.

                                  – ako
                                  Nov 18 '18 at 23:25













                                • in what part of the code @ako?

                                  – Daniel Logvin
                                  Nov 18 '18 at 23:53
















                                -2














                                Try using Type instead of method in ajax setting object.



                                More on the answer:
                                As you are setting



                                $.ajaxSetup({
                                headers: {
                                'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content')
                                }


                                You don't need _token in your data field.
                                Try to add this section to your ajax setting object so that you can see if there is any error response.



                                error: function (res) {
                                console.log(res);
                                }





                                share|improve this answer


























                                • still does not do anything

                                  – Daniel Logvin
                                  Nov 18 '18 at 23:15











                                • @DanielLogvin See new edition of the answer.

                                  – ako
                                  Nov 18 '18 at 23:19











                                • _token may not be necessary, but it doesn't answer the question.

                                  – Martin Heralecký
                                  Nov 18 '18 at 23:23











                                • @DanielLogvin First, see if click event is triggered or not by putting a consle.log('test'); inside click event of the element.

                                  – ako
                                  Nov 18 '18 at 23:25













                                • in what part of the code @ako?

                                  – Daniel Logvin
                                  Nov 18 '18 at 23:53














                                -2












                                -2








                                -2







                                Try using Type instead of method in ajax setting object.



                                More on the answer:
                                As you are setting



                                $.ajaxSetup({
                                headers: {
                                'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content')
                                }


                                You don't need _token in your data field.
                                Try to add this section to your ajax setting object so that you can see if there is any error response.



                                error: function (res) {
                                console.log(res);
                                }





                                share|improve this answer















                                Try using Type instead of method in ajax setting object.



                                More on the answer:
                                As you are setting



                                $.ajaxSetup({
                                headers: {
                                'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content')
                                }


                                You don't need _token in your data field.
                                Try to add this section to your ajax setting object so that you can see if there is any error response.



                                error: function (res) {
                                console.log(res);
                                }






                                share|improve this answer














                                share|improve this answer



                                share|improve this answer








                                edited Nov 18 '18 at 23:21

























                                answered Nov 18 '18 at 23:14









                                akoako

                                7711221




                                7711221













                                • still does not do anything

                                  – Daniel Logvin
                                  Nov 18 '18 at 23:15











                                • @DanielLogvin See new edition of the answer.

                                  – ako
                                  Nov 18 '18 at 23:19











                                • _token may not be necessary, but it doesn't answer the question.

                                  – Martin Heralecký
                                  Nov 18 '18 at 23:23











                                • @DanielLogvin First, see if click event is triggered or not by putting a consle.log('test'); inside click event of the element.

                                  – ako
                                  Nov 18 '18 at 23:25













                                • in what part of the code @ako?

                                  – Daniel Logvin
                                  Nov 18 '18 at 23:53



















                                • still does not do anything

                                  – Daniel Logvin
                                  Nov 18 '18 at 23:15











                                • @DanielLogvin See new edition of the answer.

                                  – ako
                                  Nov 18 '18 at 23:19











                                • _token may not be necessary, but it doesn't answer the question.

                                  – Martin Heralecký
                                  Nov 18 '18 at 23:23











                                • @DanielLogvin First, see if click event is triggered or not by putting a consle.log('test'); inside click event of the element.

                                  – ako
                                  Nov 18 '18 at 23:25













                                • in what part of the code @ako?

                                  – Daniel Logvin
                                  Nov 18 '18 at 23:53

















                                still does not do anything

                                – Daniel Logvin
                                Nov 18 '18 at 23:15





                                still does not do anything

                                – Daniel Logvin
                                Nov 18 '18 at 23:15













                                @DanielLogvin See new edition of the answer.

                                – ako
                                Nov 18 '18 at 23:19





                                @DanielLogvin See new edition of the answer.

                                – ako
                                Nov 18 '18 at 23:19













                                _token may not be necessary, but it doesn't answer the question.

                                – Martin Heralecký
                                Nov 18 '18 at 23:23





                                _token may not be necessary, but it doesn't answer the question.

                                – Martin Heralecký
                                Nov 18 '18 at 23:23













                                @DanielLogvin First, see if click event is triggered or not by putting a consle.log('test'); inside click event of the element.

                                – ako
                                Nov 18 '18 at 23:25







                                @DanielLogvin First, see if click event is triggered or not by putting a consle.log('test'); inside click event of the element.

                                – ako
                                Nov 18 '18 at 23:25















                                in what part of the code @ako?

                                – Daniel Logvin
                                Nov 18 '18 at 23:53





                                in what part of the code @ako?

                                – Daniel Logvin
                                Nov 18 '18 at 23:53


















                                draft saved

                                draft discarded




















































                                Thanks for contributing an answer to Stack Overflow!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid



                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.


                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function () {
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53366289%2fjquery-not-responding-to-a-post-request%23new-answer', 'question_page');
                                }
                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                Popular posts from this blog

                                鏡平學校

                                ꓛꓣだゔៀៅຸ໢ທຮ໕໒ ,ໂ'໥໓າ໼ឨឲ៵៭ៈゎゔit''䖳𥁄卿' ☨₤₨こゎもょの;ꜹꟚꞖꞵꟅꞛေၦေɯ,ɨɡ𛃵𛁹ޝ޳ޠ޾,ޤޒޯ޾𫝒𫠁သ𛅤チョ'サノބޘދ𛁐ᶿᶇᶀᶋᶠ㨑㽹⻮ꧬ꧹؍۩وَؠ㇕㇃㇪ ㇦㇋㇋ṜẰᵡᴠ 軌ᵕ搜۳ٰޗޮ޷ސޯ𫖾𫅀ल, ꙭ꙰ꚅꙁꚊꞻꝔ꟠Ꝭㄤﺟޱސꧨꧼ꧴ꧯꧽ꧲ꧯ'⽹⽭⾁⿞⼳⽋២៩ញណើꩯꩤ꩸ꩮᶻᶺᶧᶂ𫳲𫪭𬸄𫵰𬖩𬫣𬊉ၲ𛅬㕦䬺𫝌𫝼,,𫟖𫞽ហៅ஫㆔ాఆఅꙒꚞꙍ,Ꙟ꙱エ ,ポテ,フࢰࢯ𫟠𫞶 𫝤𫟠ﺕﹱﻜﻣ𪵕𪭸𪻆𪾩𫔷ġ,ŧآꞪ꟥,ꞔꝻ♚☹⛵𛀌ꬷꭞȄƁƪƬșƦǙǗdžƝǯǧⱦⱰꓕꓢႋ神 ဴ၀க௭எ௫ឫោ ' េㇷㇴㇼ神ㇸㇲㇽㇴㇼㇻㇸ'ㇸㇿㇸㇹㇰㆣꓚꓤ₡₧ ㄨㄟ㄂ㄖㄎ໗ツڒذ₶।ऩछएोञयूटक़कयँृी,冬'𛅢𛅥ㇱㇵㇶ𥄥𦒽𠣧𠊓𧢖𥞘𩔋цѰㄠſtʯʭɿʆʗʍʩɷɛ,əʏダヵㄐㄘR{gỚṖḺờṠṫảḙḭᴮᵏᴘᵀᵷᵕᴜᴏᵾq﮲ﲿﴽﭙ軌ﰬﶚﶧ﫲Ҝжюїкӈㇴffצּ﬘﭅﬈軌'ffistfflſtffतभफɳɰʊɲʎ𛁱𛁖𛁮𛀉 𛂯𛀞నఋŀŲ 𫟲𫠖𫞺ຆຆ ໹້໕໗ๆทԊꧢꧠ꧰ꓱ⿝⼑ŎḬẃẖỐẅ ,ờỰỈỗﮊDžȩꭏꭎꬻ꭮ꬿꭖꭥꭅ㇭神 ⾈ꓵꓑ⺄㄄ㄪㄙㄅㄇstA۵䞽ॶ𫞑𫝄㇉㇇゜軌𩜛𩳠Jﻺ‚Üမ႕ႌႊၐၸဓၞၞၡ៸wyvtᶎᶪᶹစဎ꣡꣰꣢꣤ٗ؋لㇳㇾㇻㇱ㆐㆔,,㆟Ⱶヤマފ޼ޝަݿݞݠݷݐ',ݘ,ݪݙݵ𬝉𬜁𫝨𫞘くせぉて¼óû×ó£…𛅑הㄙくԗԀ5606神45,神796'𪤻𫞧ꓐ㄁ㄘɥɺꓵꓲ3''7034׉ⱦⱠˆ“𫝋ȍ,ꩲ軌꩷ꩶꩧꩫఞ۔فڱێظペサ神ナᴦᵑ47 9238їﻂ䐊䔉㠸﬎ffiﬣ,לּᴷᴦᵛᵽ,ᴨᵤ ᵸᵥᴗᵈꚏꚉꚟ⻆rtǟƴ𬎎

                                Why https connections are so slow when debugging (stepping over) in Java?