$.get() is jQuery’s readable GET shorthand. This tutorial covers both official signatures, how it maps to $.ajax(), the success callback arguments, parsing JSON with the fourth dataType argument, chaining .done(), .fail(), and .always() on the returned jqXHR, the settings-object form since jQuery 1.12, silent error behavior, and when to upgrade to full $.ajax().
01
GET Shorthand
$.get(url, ...)
02
Query Data
Append to URL
03
success
Callback args
04
dataType
json, html, text
05
jqXHR
done/fail/always
06
settings
Since jQuery 1.12
Fundamentals
Introduction
Most pages need to load data from a server — a user profile, a list of posts, an HTML fragment for a sidebar. jQuery makes that one line with $.get(). Pass a URL and a callback; jQuery sends an asynchronous HTTP GET request and invokes your function when the server responds successfully.
Under the hood, $.get() is not a separate transport — it is a thin wrapper around jQuery.ajax() with type: "GET" preset. That means you inherit the same jqXHR return value, global Ajax events on document, and Promise-style chaining. When your needs outgrow a one-liner — custom headers, POST bodies, or global: false — you drop down to $.ajax() without changing mental models.
Concept
Understanding jQuery.get()
jQuery.get() loads data from a server using an HTTP GET request. The method returns immediately with a jqXHR object while the network call runs in the background. If you pass a success function, jQuery calls it with the response body once parsing completes — the exact type depends on the optional dataType argument or jQuery’s intelligent guess from the Content-Type header.
The optional data argument is a plain object (or string) appended to the URL as query parameters — ideal for search terms, page numbers, or filter flags. Because GET requests should be idempotent reads, keep writes and sensitive payloads on $.post() or full $.ajax() with method: "POST".
💡
Beginner Tip
Always chain .fail() on the jqXHR returned by $.get(). Unlike $.ajax() with an explicit error setting, a bare $.get() fails silently on HTTP errors — users see nothing unless you handle failures.
Four ways to move data — pick the shortest readable form or the API with the control you need.
$.get()
GET shorthand
$.get(url, data, success) — one-liner for reads; internally calls $.ajax() with type: "GET"
$.ajax()
full control
Every setting exposed — headers, beforeSend, method, dataType, global:false, and jqXHR chaining
fetch()
native API
Browser built-in — no jQuery dependency; does not trigger jQuery global Ajax events
$.post()
POST shorthand
$.post(url, data, success) — same positional pattern for writes; data sent in request body
Use $.get() for simple reads with minimal configuration. Use $.ajax() when you need headers, beforeSend, or global: false. Use $.post() for form submissions and creates. Use fetch() in vanilla JS projects without jQuery.
Hands-On
Examples Gallery
Five progressive examples from a basic GET with a success callback through query parameters, explicit dataType: "json", jqXHR chaining, and the settings-object signature. Each links to a Try-it lab where you can edit and run the code in the browser.
📚 Core Patterns
Load and display data with the positional $.get() signature.
Example 1 — Basic GET with success callback
Fetch a JSON post from JSONPlaceholder and display the title when the request succeeds.
User clicks #load → $.get() sends GET /posts/1
Server returns JSON → success callback runs → #result shows "Title: ..."
Network or server error → success never runs (silent unless .fail() chained)
How It Works
The second argument is the success callback — jQuery invokes it with the response body when the server returns a success status. Without an explicit dataType, jQuery guesses the type from the Content-Type header; JSONPlaceholder sends application/json, so data.title works.
Example 2 — GET with data query object
Pass a plain object as the second argument — jQuery serializes it and appends it to the URL as query parameters.
userId = 1 → GET /posts?userId=1
success receives JSON array → #result shows "Found 10 posts for user 1"
Change #user-id → query string updates automatically
How It Works
For GET requests, the data object becomes URL query parameters — jQuery handles encoding. This is the standard pattern for filtered lists, paginated feeds, and search boxes. Keep parameter names short and server-documented.
Example 3 — Fourth argument dataType: "json"
Pass "json" as the fourth argument so jQuery parses the body into a JavaScript object before the callback runs.
GET /users/1 with dataType "json"
success receives parsed object → #name and #email populated
Invalid JSON would fail silently unless .fail() is chained
How It Works
When you omit data but need dataType, pass null (or undefined) as the second argument — a jQuery 3.x requirement when skipping straight to the success callback slot. With "json", jQuery parses the body; invalid JSON triggers an error path on the jqXHR.
📈 jqXHR & Settings Object
Chain Promise-style handlers and use the jQuery 1.12+ settings signature.
Click #load-album → GET /albums/1 with dataType json
.done() fills #title and #id with parsed album fields
cache: false adds _=timestamp to avoid stale GET cache
How It Works
The settings-object signature accepts any $.ajax() option except you omit type — jQuery forces GET. Use this form when you need cache: false, beforeSend, or other options without dropping to the full $.ajax() call syntax.
Applications
🚀 Common Use Cases
Load JSON records — fetch a user, post, or product by ID and render fields in the DOM.
Filtered lists — pass search terms and pagination as the data query object.
HTML partials — retrieve server-rendered fragments and inject with .html() (omit dataType or set "html").
Autocomplete — debounced GET as the user types; abort the previous jqXHR on each keystroke.
Polling / refresh — periodic $.get() to update a dashboard widget without reloading the page.
Prefetch — fire-and-forget GET to warm a cache before the user clicks (chain .done() to store results locally).
🧠 How $.get() Works Internally
1
Expand to $.ajax()
$.get() maps positional args to { url, data, success, dataType, type: "GET" } and delegates to jQuery.ajax().
$.ajax()
2
Return jqXHR immediately
Caller receives a jqXHR object right away — attach .done() / .fail() before or after the response arrives.
jqXHR
3
Global ajaxStart / ajaxSend
Unless overridden with global: false in the settings form, document-level Ajax events fire like any $.ajax() call.
ajaxSend
4
Parse response
jQuery applies dataType converters — JSON becomes an object, HTML stays a string, script may execute.
dataType
5
success + .done()
On HTTP success, the legacy success callback and chained .done() handlers both run with (data, textStatus, jqXHR).
.done()
6
👉
Error path or ajaxComplete
Failures invoke .fail() (not the success callback) — silently if unhandled. .always() and global ajaxComplete run either way.
Important
📝 Notes
$.get() is asynchronous — code after the call runs before the response arrives.
It is shorthand for $.ajax() with type: "GET" — same jqXHR, same global Ajax events.
Silent failure: HTTP errors fail quietly unless you chain .fail() or register a global ajaxError handler.
Same-origin policy: cross-domain GET requests require CORS headers on the server; otherwise the browser blocks the response.
JSONP and script: script and JSONP requests bypass same-origin restrictions but do not use XHR — jqXHR in success may be undefined.
Prefer .done() / .fail() / .always() over deprecated jqXHR .success() / .error() / .complete() (removed in jQuery 3.0).
When skipping data but providing dataType in the positional form, pass null as the second argument (jQuery 3.x).
The settings-object form $.get({ ... }) is available since jQuery 1.12 — it sets type to GET automatically.
Compatibility
Browser Support
jQuery.get() is part of jQuery’s core Ajax module — not a native DOM API. It works wherever jQuery’s Ajax transport runs: all browsers supported by your jQuery version, including legacy IE with supported jQuery builds.
✓ jQuery 1.0+
jQuery.get() method
Supported in jQuery 1.x, 2.x, and 3.x across all modern browsers and IE with supported jQuery builds. jqXHR promise methods (.done, .fail, .always) arrived in jQuery 1.5. The settings-object signature $.get({ url }) requires jQuery 1.12+. Cross-domain GET requires CORS or JSONP/script transports.
100%With jQuery
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
$.get()Universal
Bottom line: Safe in any jQuery project. Use $.get() for simple reads; $.ajax() when you need full settings; $.post() for writes. fetch() is the native alternative when jQuery is not loaded.
Wrap Up
Conclusion
jQuery.get() is the fastest path from URL to callback for read-only HTTP requests. Learn the positional signature (url, data, success, dataType), chain .fail() so errors are not silent, and reach for the settings object when you need cache: false or other $.ajax() options without writing type: "GET" yourself.
When you need to send data in the request body, continue with the jQuery.post() tutorial. When you always expect JSON from a GET endpoint, the dedicated jQuery.getJSON() tutorial is even clearer than passing "json" as the fourth argument.
Chain .fail() on every $.get() so users see errors
Set dataType: "json" explicitly when you expect JSON from the server
Return jqXHR from helper functions so callers can chain or abort
Use the data object for query parameters instead of manual string concatenation
Upgrade to $.ajax() when you need headers, POST, or global: false
❌ Don’t
Assume errors surface automatically — $.get() fails silently by default
Send sensitive data in GET query strings — use $.post() over HTTPS
Forget CORS — cross-origin $.get() calls fail without server headers
Use deprecated jqXHR .success() / .error() / .complete() in jQuery 3.x
Leave in-flight requests running after SPA navigation — call .abort() on teardown
Summary
Key Takeaways
Knowledge Unlocked
Six things to remember about $.get()
URL in, jqXHR out, chain fail().
6
Core concepts
get01
GET Shorthand
$.get(url, ...)
Read
data02
Query Data
Append to URL
Filter
cb03
success
data, status, jqXHR
Callback
json04
dataType
Parse response
json
xhr05
jqXHR
done/fail/always
Promise
cfg06
settings
Since 1.12
Object
❓ Frequently Asked Questions
jQuery.get() is a shorthand for $.ajax() configured as a GET request. Pass a URL, optional data object, optional success callback, and optional dataType — jQuery sends the request asynchronously and returns a jqXHR object. Since jQuery 1.12 you can also pass a single settings object: $.get({ url, data, dataType }). It is the readable one-liner most developers reach for when loading data from a server.
It returns a jqXHR object — a superset of XMLHttpRequest that implements jQuery's Promise interface. Chain .done(fn) for success, .fail(fn) for errors, and .always(fn) for either outcome. You can attach handlers immediately or after the request completes; if it already finished, the callback fires right away. Call jqXHR.abort() to cancel an in-flight GET.
$.get() is sugar for $.ajax({ url, data, success, dataType, type: "GET" }). Use $.get() when you only need a simple GET with minimal options. Use $.ajax() when you need full control: custom headers, beforeSend, POST method, global: false, contentType, or other settings $.get() does not expose as positional arguments.
The success callback signature is function(data, textStatus, jqXHR). data is the parsed response body — a string, HTML fragment, or JavaScript object depending on dataType and Content-Type. textStatus is typically "success". jqXHR is the same object returned by $.get(). For JSONP and some cross-domain GET requests, jqXHR and textStatus may be undefined because no XHR is used.
Yes — if the server returns an error status or the request fails, $.get() does not alert you unless you chain .fail() on the returned jqXHR, register a global ajaxError handler on document, or provide error handling another way. The success callback simply never runs. Always chain .fail() or use .always() when users need feedback on failure.
Use $.get() to read data — fetching JSON, HTML snippets, or search results where parameters go in the query string. Use $.post() to send data that should appear in the request body — form submissions, creating records, or any write operation. Both are shorthands over $.ajax() with preset HTTP methods.
Did you know?
$.get() has existed since jQuery 1.0, but the object returned only became a full jqXHR with Promise methods in jQuery 1.5. The settings-object signature $.get({ url }) arrived in jQuery 1.12 alongside the same change for $.post() and $.getJSON(). Under the hood, every call still routes through jQuery.ajax() — which is why global ajaxStart and ajaxStop fire unless you pass global: false in the settings form.