Created
August 26, 2009 08:55
-
-
Save ecarnevale/175405 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // [jQuery] Headers support for $.ajax | |
| // RPC and REST systems recommend using the HTTP ACCEPT header here is how to use them with jQuery | |
| $.ajax({ | |
| beforeSend: function(xhrObj){ | |
| xhrObj.setRequestHeader("Content-Type","application/json"); | |
| xhrObj.setRequestHeader("Accept","application/json"); | |
| } | |
| type: "POST", | |
| url: "/JSON-RPC", | |
| processData: false, | |
| data: jsonData, | |
| dataType: "json", | |
| success: function(json){ | |
| do something... | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment