在ajax .done中为函数提供了哪些参数? [英] What arguments are supplied to the function inside an ajax .done?
问题描述
我有以下内容:
$.ajax(link.href,
{
cache: false,
dataType: 'html'
})
.done(onDialogDone)
.fail(onDialogFail);
这样可以正常工作并调用onDialogDone。但是,我希望看到哪些参数提供给onDialogDone,以及我期望在onDialogFail中看到什么。
This works fine and onDialogDone is called. However what arguments should I expect to see supplied to the onDialogDone and what should I expect to see for onDialogFail.
我问的原因是因为我使用的是typescript,我想在定义onDialogDone和onDialogFail时提供正确的参数。
The reason I am asking is because I use typescript and I want to supply the correct arguments when I define my onDialogDone and onDialogFail.
推荐答案
.done()
和 .fail()$的参数c $ c>与相应的
成功的参数相同:
和错误:
$。ajax()
功能,即:
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) { ... } );
和
.fail( function(jqXHR, textStatus, errorThrown) { ... } );
出于打字稿的目的, textStatus
和 errorThrown
是字符串, jqXHR
是对象
,以及 data
取决于远程服务器发送给你的东西。
For the purposes of typescript, textStatus
and errorThrown
are strings, jqXHR
is an Object
, and data
depends on what the remote server sends you.
这篇关于在ajax .done中为函数提供了哪些参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!