这些参数在 JQuery 文档中的什么位置?
jqXHR.done(function( data, textStatus, jqXHR ) {});
http://api.jquery.com/deferred.done/
例如,我尝试搜索data
,但找不到它。
此外,我还看到类似 .done( function( msg ){} )
或
// Create a deferred object
var dfd = $.Deferred();
// Add handlers to be called when dfd is resolved
dfd
// .done() can take any number of functions or arrays of functions
.done( [ fn1, fn2 ], fn3, [ fn2, fn1 ] )
// We can chain done methods, too
.done(function( n ) {
$( "p" ).append( n + " we're done." );
});
所以我显然对如何将参数传递给这个函数感到困惑。
我需要获取 responseText
我想,我正在 PHP 中回显一个数字。
谢谢!
最佳答案
A function to be called if the request succeeds. The function gets passed three arguments: The data returned from the server, formatted according to the dataType parameter; a string describing the status; and the jqXHR (in jQuery 1.4.x, XMLHttpRequest) object.
您想要数据
;这是您的服务器响应。
关于javascript - 了解 $.Ajax 上的 JQuery 文档,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19031827/