| Recommend this page to a friend! |
| Info | Documentation | Reputation | Support forum | Blog | Links |
| Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
| 2025-07-09 (2 days ago) | Not enough user ratings | Total: 241 | All time: 197 This week: 4 | |||||
| Version | License | JavaScript version | Categories | |||
| comm 12 | MIT/X Consortium ... | 1.0 | AJAX, jQuery |
| Description | Author | |||
This is a jQuery plugin to send server requests via Websockets, AJAX or XDR. Innovation Award
|
Handles XHR, XDR, WS & WSS protocols
Fork me @ https://www.github.com/jas-/comm.js
Here are a couple of examples
The default use case
comm(function(err, response){
if (err) throw err;
console.log(response);
});
An example sending a post request with a JSON object
comm({
method: 'post',
data: {abc: '123', xyz: 345}
}, function(err, res){
if (err) throw err;
console.log(res);
});
Here is how you can use the websocket or secure web socket protocols
comm({
data: 'ping test',
url: 'ws://echo.websocket.org'
}, function(err, response){
if (err) throw err;
console.log(response);
});
Need to use custom headers? See RFC-4229 for a complete list
comm({
headers: {
Content-Type: 'text/plain'
}
}, function(err, response){
if (err) throw err;
console.log(response);
});
To attach a form object as the payload the simpliest method would be the following example.
var formData = new FormData(document.getElementById('form-id'));
comm({
data: formData
}, function(err, response){
if (err) throw err;
console.log(response);
});
This is the least tested protocol this library supports. It will only be used
when the clients browser is internet explorer, the version is less than 10 has
access to the window.XDomainRequest object and if the URL specified does not
match the current window.
If you wish to use this for CORS requests which it does support you must configure your web server to allow the following header params (this example is tuned to support authentication credentials while limiting access vs. using a wildcard origin such as *)
Access-Control-Allow-Origin: https://example.com
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
Access-Control-Allow-Headers: Cache-Control, Content-Type
Access-Control-Allow-Credentials: true
| File | Role | Description |
|---|---|---|
| Data | Auxiliary data | |
| Class | Class source | |
| Class | Class source | |
| Data | Auxiliary data | |
| Doc. | Auxiliary data | |
| Data | Auxiliary data |
| Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
| 100% |
|
|
| User Comments (1) | |||||
| |||||
| Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.