jQuery.post(url [, data] [, success] [, dataType]) sends an HTTP POST request (since 1.0). It is shorthand for $.ajax({ type: "POST", … }). Data goes in the request body — not the URL.
Remember
$.post("ajax/test.html", function (data) {
$(".result").html(data);
});
// Equivalent to:
$.ajax({
type: "POST",
url: url,
data: data,
success: success,
dataType: dataType
});
// POST responses are never cached
serialize() → "title=…&body=…&userId=1"
POST body uses that string
Success → "Saved! id=101"
How It Works
Read..serialize() builds a URL-encoded string from named fields.
Send. Pass the string as data — jQuery does not re-encode strings.
POST. The string becomes the request body.
Respond. Handle the server reply in success / .done().
Example 4 — Ajax Form Submit
Official demo idea: intercept submit, POST via Ajax, update a result box.
jQuery
$("#searchForm").on("submit", function (event) {
event.preventDefault();
var $form = $(this);
var term = $form.find("input[name='s']").val();
var url = $form.attr("action");
var posting = $.post(url, { s: term });
posting.done(function (data) {
$("#result").text("Search sent: " + term);
});
});
Valid URL → done, then always
Invalid URL → fail, then always
How It Works
jqXHR.$.post() returns a Promise-like object.
Success..done() runs on HTTP success.
Error..fail() runs on network/HTTP failure — avoid silent errors.
Always..always() runs for either outcome (cleanup, spinners).
Edge Cases & Pitfalls
Check these before shipping form POSTs and create APIs.
silent
Errors are silent by default
Without .fail() or a global ajaxError handler, failed POSTs look like nothing happened.
cache
POST is never cached
cache / ifModified from $.ajaxSetup() do not apply to $.post().
cors
Same-origin policy still applies
Cross-origin POSTs need CORS. Most browsers block plain cross-domain Ajax without it.
json
Default body is not JSON
Objects become form-urlencoded. For application/json, use $.ajax() with contentType and JSON.stringify.
Compatibility
Browser Support
$.post() has been part of jQuery since 1.0. The settings-object form arrived in 1.12 / 2.2. It works wherever your loaded jQuery version can run Ajax.
✓ Stable · jQuery 1.0+
jQuery.post()
Works in every browser that runs your loaded jQuery version. Prefer a current jQuery 3.x build for modern projects.
100%With jQuery Ajax
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
$.post()Universal
Bottom line: Safe for everyday form POSTs and create APIs. Always chain .fail(), and use $.ajax() when you need JSON bodies or custom headers.
Analysis
Performance Notes
Approach
Cost
Best for
$.post(url, data)
Cheap
Simple form / create requests
Large serialized forms
Higher
Send only needed fields
JSON body via $.ajax()
Clearer
Nested APIs expecting JSON
A single POST is inexpensive. Cost is usually network and payload size — keep bodies small and avoid posting unused form fields.
Remember
Key Takeaways
Role: readable POST shorthand for $.ajax({ type: "POST" }).
Body: objects become form-urlencoded via $.param().
jqXHR: chain .done() / .fail() / .always().
Safety: never cached; errors are silent unless handled.
One line:$.post() is jQuery’s one-liner for sending data in an HTTP POST body.
Frequently Asked Questions
jQuery.post() is a shorthand for $.ajax() configured as a POST request. Pass a URL, optional data, optional success callback, and optional dataType. Since jQuery 1.12 you can also pass a settings object: $.post({ url, data, dataType }). It returns a jqXHR object.
Both share the same positional signature, but $.post() sets type to POST so data goes in the request body (application/x-www-form-urlencoded by default), while $.get() appends data to the URL. Use $.get() for reads and $.post() for writes and form submissions.
A jqXHR object — a Promise-like wrapper around XMLHttpRequest. Chain .done(fn) for success, .fail(fn) for errors, and .always(fn) for either outcome. Handlers can be attached after completion; if the request already finished, the callback fires immediately.
No. Pages fetched with POST are never cached. The cache and ifModified options in $.ajaxSetup() have no effect on $.post() requests.
Yes — unless you chain .fail() on the returned jqXHR or register a global ajaxError handler, errors do not surface. The success callback simply never runs. Always chain .fail() when users need feedback.
Use $.post() for simple POSTs. Use $.ajax() for full control: custom headers, contentType application/json, beforeSend, processData false for FormData, global false, or other settings not exposed as positional arguments.