Calling a C# method with jquery

后端 未结 5 1521
旧时难觅i
旧时难觅i 2021-02-09 18:00

I am trying to call a method with jQuery on a button click.This is waht I have so far:

$(\"a.AddToCart\").click(function () {
            var link =         


        
5条回答
  •  隐瞒了意图╮
    2021-02-09 18:50

    Add Success and error function to check your ajax functionality

           ...
    
    
           $.ajax({
                     type:"POST",
                     url: "/Account/AddToCartHack",
                     data: {url : link},
                     contentType: "application/json; charset=utf-8",
                     dataType: "json",
                   success: function(){
                     alert('success');
                    },
                  error:function(){ 
                      alert('error');
                    }
                });
            ....
    

提交回复
热议问题