Skip to content

jQuery.ajaxTransport: Add object signature to completeCallback#1300

Open
mgol wants to merge 1 commit into
jquery:mainfrom
mgol:ajax-transport-completeCallback-object
Open

jQuery.ajaxTransport: Add object signature to completeCallback#1300
mgol wants to merge 1 commit into
jquery:mainfrom
mgol:ajax-transport-completeCallback-object

Conversation

@mgol
Copy link
Copy Markdown
Member

@mgol mgol commented Mar 30, 2026

This will be supported in jQuery >=3.8 <4 || >=4.1.

Docs

Before

Screenshot 2026-03-30 at 23 58 32

After

Screenshot 2026-03-31 at 21 36 23

Example

Before

Screenshot 2026-03-31 at 00 00 32

After

Screenshot 2026-03-31 at 00 00 39

New category (4.1)

Screenshot 2026-03-30 at 23 50 29

@mgol mgol requested a review from timmywil March 30, 2026 22:10
@mgol mgol force-pushed the ajax-transport-completeCallback-object branch from 7765834 to b35c355 Compare March 31, 2026 19:35
@mgol mgol added this to the 3.8.0 milestone Mar 31, 2026
…teCallback

This will be supported in jQuery `>=3.8 <4 || >=4.1`.
@mgol mgol force-pushed the ajax-transport-completeCallback-object branch from b35c355 to ff75c91 Compare May 30, 2026 22:27
@mgol
Copy link
Copy Markdown
Member Author

mgol commented Jun 1, 2026

The latest version of the upper part of the diff:
Screenshot 2026-06-01 at 18 35 01

Comment thread entries/jQuery.ajax.xml
Comment thread entries/jQuery.ajaxTransport.xml
@mgol mgol requested a review from timmywil June 1, 2026 20:06
<li><code>completeCallback</code> is the callback used to notify Ajax of the completion of the request</li>
</ul>
<p><code>completeCallback</code> has the following signature:</p>
<p>In jQuery 3.8, 4.1 or newer <code>completeCallback</code> accepts a single params object:</p>
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@timmywil Would the following be clearer? I have a feeling it would.

Suggested change
<p>In jQuery 3.8, 4.1 or newer <code>completeCallback</code> accepts a single params object:</p>
<p>In jQuery 3.8 or newer (with the single exception of jQuery 4.0.0), completeCallback accepts a single params object:</p>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's better, but I still like mentioning 4.1. What about this?

Suggested change
<p>In jQuery 3.8, 4.1 or newer <code>completeCallback</code> accepts a single params object:</p>
<p>As of jQuery 3.8 and 4.1 (excluding jQuery 4.0), <code>completeCallback</code> accepts a single params object:</p>

<li><code>statusText</code> is the statusText of the response.</li>
<li><code>responses</code> (Optional) is An object containing dataType/value that contains the response in all the formats the transport could provide (for instance, a native XMLHttpRequest object would set responses to <code>{ xml: XMLData, text: textData }</code> for a response that is an XML document)</li>
<li><code>headers</code> (Optional) is a string containing all the response headers if the transport has access to them (akin to what <code>XMLHttpRequest.getAllResponseHeaders()</code> would provide).</li>
<li><code>responseURL</code> (Optional, <strong>as of jQuery 4.1</strong>) is the final URL of the response after any redirects, if the transport has access to it (akin to what <code>XMLHttpRequest.responseURL</code> would provide). It is exposed on the jqXHR object as <code>jqXHR.responseURL</code>.</li>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<li><code>responseURL</code> (Optional, <strong>as of jQuery 4.1</strong>) is the final URL of the response after any redirects, if the transport has access to it (akin to what <code>XMLHttpRequest.responseURL</code> would provide). It is exposed on the jqXHR object as <code>jqXHR.responseURL</code>.</li>
<li><code>responseURL</code> (Optional) is the final URL of the response after any redirects, if the transport has access to it (akin to what <code>XMLHttpRequest.responseURL</code> would provide). It is exposed on the jqXHR object as <code>jqXHR.responseURL</code>. <strong>Added in jQuery 4.1.</strong></li>

Previous language sounds like it was required before jQuery 4.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants