使用Ajax实现异步请求

以下三种ajax写法,供大家参考

1.   $.ajax({       
     url: "/ObjectType/UpdateType",
     type: 'post',
     dataType: 'json',
     data: { Info: resultinfo },
     success: function (Json) {  

     },                                              
     errorr:function (Json)   {  

    },                                          
     });

2.  $.ajax("/Report/Generate", {
                    method: "post",
                    data: { Info: resultinfo },
                }).done(function (result) { 
                   alert(result)            
                }).fail(function (result) { 
                    alert(result)                  
                })

3. $.post("@Url.Action("Confirm", "MobileAlarm", new { Info=resultinfo})", function (data){
                 alert(data)            
            }).fail(function (error) {
               alert(error)        
            });

猜你喜欢

转载自blog.csdn.net/qq_42335551/article/details/81199760