Capture POST parameter with jQuery. This project will help you if you are trying to get any POST parameter. (This project is referenced from http://stackoverflow.com/a/1409029/3352865 -- profit!)
- Get any post parameter formatted javascript object
- use html5 localStorage when available (else cookie)
- same-origin (same domain and port)
- browser support localStorage
This plugin is saves form data as human-readable text format(json) and save to cookie storage when (1) localStorage is unavailable (2) target domain and port(action) is different(Read this). This operation is very dangerous if web page is not secured and use this for important form data. please use SSL.
This plugin is not working when target domain is different because this plugin uses localStorage & cookie.
bower
Via bower.
$ bower install jquery-postcapture
Or add jquery-postcapture
to your apps bower.json
.
"dependencies": {
"jquery-postcapture": "latest"
}
standalone
First, download a distribution from Releases.
Include script after the jQuery library (unless you are packaging scripts somehow else):
<script src="/path/to/jquery.postcapture.js"></script>
Do not hotlink the raw script url. (https://raw.github.com/...). The file is being served as text/plain and as such being blocked in Internet Explorer on Windows 7 for instance (because of the wrong MIME type).
Bottom line: GitHub is not a CDN.
Requires jQuery 1.6.x or higher. (support all jQuery versions)
$('#form').capture();
Read specific input value:
$.captures('name'); // -> value
Read specific(filter) input values:
$.captures(['name1', 'name2', 'name3']); // -> { 'name1': 'value', ... }
Read all available input values:
$.captures(); // -> { 'name': 'value', ... }
$ git clone https://github.com/ssut/jQuery-PostCapture.git
$ cd jQuery-PostCapture/
$ npm install
$ npm install grunt-cli -g
To run the grunt-watch suite locally:
$ grunt watch
To run the test suite locally:
$ npm test
Version | Notes |
---|---|
0.0.1 | First release |
SuHun Han (@ssut)
This plugin is available under the BSD 3-Clause license.