Skip to content

Commit

Permalink
jQuery.get:jQuery.post: Document issues with data: null with 3 params
Browse files Browse the repository at this point in the history
In jQuery 3.x and older, when providing a `null` value for `success` you also
have to provide the `data` parameter; you can set it to `undefined`.

Document this restriction of `jQuery.get` & `jQuery.post`.

Ref jquery/jquery#4989
Ref jquery/jquery#5139
  • Loading branch information
mgol committed Nov 6, 2023
1 parent 0b212a8 commit d8fa4f5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion entries/jQuery.get.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<argument name="data" type="PlainObject" />
<argument name="textStatus" type="String"/>
<argument name="jqXHR" type="jqXHR"/>
<desc>A callback function that is executed if the request succeeds. Required if <code>dataType</code> is provided, but you can use <code>null</code> or <a href="/jQuery.noop/"><code>jQuery.noop</code></a> as a placeholder.</desc>
<desc>A callback function that is executed if the request succeeds. Required if <code>dataType</code> is provided, but you can use <code>null</code> or <a href="/jQuery.noop/"><code>jQuery.noop</code></a> as a placeholder. <strong>NOTE:</strong> In jQuery 3.x and older, when providing a <code>null</code> value for <code>success</code> you also have to provide the <code>data</code> parameter; you can set it to <code>undefined</code>.</desc>
</argument>
<argument name="dataType" optional="true" type="String">
<desc>The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html).</desc>
Expand Down
2 changes: 1 addition & 1 deletion entries/jQuery.post.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<argument name="data" type="PlainObject" />
<argument name="textStatus" type="String"/>
<argument name="jqXHR" type="jqXHR"/>
<desc>A callback function that is executed if the request succeeds. Required if <code>dataType</code> is provided, but can be <code>null</code> in that case.</desc>
<desc>A callback function that is executed if the request succeeds. Required if <code>dataType</code> is provided, but can be <code>null</code> or <a href="/jQuery.noop/"><code>jQuery.noop</code></a> as a placeholder. <strong>NOTE:</strong> In jQuery 3.x and older, when providing a <code>null</code> value for <code>success</code> you also have to provide the <code>data</code> parameter; you can set it to <code>undefined</code>.</desc>
</argument>
<argument name="dataType" optional="true" type="String">
<desc>The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html).</desc>
Expand Down

0 comments on commit d8fa4f5

Please sign in to comment.