jQuery $.ajax() executed twice?

后端 未结 4 1887
一个人的身影
一个人的身影 2020-12-19 09:41

Here is a button:


and a bound event:

$(\"#addToCart\         


        
4条回答
  •  Happy的楠姐
    2020-12-19 09:53

    The header has the clues you need.

    Your request to '/cartManager/add' is being forwarded to '/cartManager/add/' (notice the ending forward slash).

    Replace your ajax call with

    $.ajax({
                        url: '/cartManager/add/',
                        data:{
                            pictureId: currentImageId,
                            printSize: $("#size option:selected").val(),
                            paperType: $("#paperType option:selected").val(),
                            quantity: 1
                        },
                        success: function(){
                            $("#modal").html("

    ОК

    Closing in a sec

    ").delay(1000); $("#modal").overlay().close(); } });

提交回复
热议问题