What arguments are supplied to the function inside an ajax .done?

后端 未结 3 1648
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-02 08:12

I have the following:

    $.ajax(link.href,
    {
        cache: false,
        dataType: \'html\'
    })
        .done(onDialogDone)
        .fail(onDialogFail)         


        
3条回答
  •  孤街浪徒
    2021-02-02 09:03

    The arguments for .done() and .fail() are the same as the arguments for the corresponding success: and error: parameters for the $.ajax() function, namely:

    .done( function(data, textStatus, jqXHR) { ... } );
    

    and

    .fail( function(jqXHR, textStatus, errorThrown) { ... } );
    

    For the purposes of typescript, textStatus and errorThrown are strings, jqXHR is an Object, and data depends on what the remote server sends you.

提交回复
热议问题