What is JSON-P?

JSON-P is a mechanism used to bypass same-origin policy in modern browsers and allow cross-domain AJAX requests. To learn more about JSON-P, please visit json-p.org.

What does the JSON-P Presence Service do?

It's a specialized web service that allows AJAX requests using JSON-P to be made. It queries whether or not a specific Contact At Once! merchant is online. The net result is that a merchant's presence information is now retrievable from JavaScript running on a non-Contact At Once! domain.

Expected Outputs

The JSON-P Presence Service returns an object with one key-value pair wrapped inside a function. The key is "presenceStatus" with the value being either "online" or "offline." The function name can be set by using the "Callback" parameter. If no Callback parameter is specified, the default function name will be "PresenceCallback."

Examples of JSON-P responses
For Online PresenceCallback({"presenceStatus" : "online" });
For Offline PresenceCallback({"presenceStatus" : "offline" });

Live Demo

The table below demonstrates a live example of a JSON-P Presence Service implementation using jQuery, alongside a standard presence icon for the same merchant.

Method Result
Standard Presence Button
Calling the JSON-P Presence Service w/ JQuery Status: