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.
Syntax
Start with these common calls. Keep them short and readable.
jQuery
$.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
Call
What it does
jQuery
Learn jQuery.post(): POST shorthand for $.ajax(), url/data/success/dataType, form serialize(), jqXHR done/fail/always, never-cached POSTs, silent errors, and compare with $.get().
Load jQuery before your script (CDN or local file), then wrap DOM work in $(function () { ... }) when needed.
Parameters
Parameter
Description
Step 1
Call $.post(url) or pass a data object/string for the body.
Step 2
Add a success callback, or chain .done() on the returned jqXHR.
Step 3
Optionally set dataType (e.g. "json") as the fourth argument.
Return Value
Return Value
Description
jQuery object
Most setters and traversing helpers return the jQuery collection so you can chain more methods.
jQuery Examples
Example 1 — POST with Data + Success
Official pattern: send a payload and handle the response.
jQuery
$.post("test.php", { name: "John", time: "2pm" })
.done(function (data) {
alert("Data Loaded: " + data);
});
// Live demo style:
$.post("https://jsonplaceholder.typicode.com/posts", {
title: "My new post",
body: "Created with $.post()",
userId: 1
}, function (data, textStatus, jqXHR) {
$("#result").text("Created post #" + data.id + " (" + textStatus + ")");
});
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.
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.