qiao.util.js
dependencies
- qiao.ajax by reqwest
- qiao.cookie by js-cookie
- qiao.qrcode by qrcode
documentation
- qiao.ajax, reqwest, https://www.npmjs.com/package/reqwest
- qiao.cookie, js-cookie, https://www.npmjs.com/package/js-cookie
- qiao.qrcode, qrcode, https://www.npmjs.com/package/qrcode
api
qiao.ajax
'use strict';
var qiao = require('qiao.util.js');
var test = function(){
qiao.ajax({
url: 'path/to/html'
, method: 'post'
, data: { foo: 'bar', baz: 100 }
, success: function (resp) {
qwery('#content').html(resp)
}
});
qiao.ajax({
url: 'path/to/html'
, method: 'get'
, data: [ { name: 'foo', value: 'bar' }, { name: 'baz', value: 100 } ]
, success: function (resp) {
qwery('#content').html(resp)
}
});
qiao.ajax({
url: 'path/to/json'
, type: 'json'
, method: 'post'
, error: function (err) { }
, success: function (resp) {
qwery('#content').html(resp.content)
}
});
qiao.ajax({
url: 'path/to/json'
, type: 'json'
, method: 'post'
, contentType: 'application/json'
, headers: {
'X-My-Custom-Header': 'SomethingImportant'
}
, error: function (err) { }
, success: function (resp) {
qwery('#content').html(resp.content)
}
});
// Uses XMLHttpRequest2 credentialled requests (cookies, HTTP basic auth) if supported
qiao.ajax({
url: 'path/to/json'
, type: 'json'
, method: 'post'
, contentType: 'application/json'
, crossOrigin: true
, withCredentials: true
, error: function (err) { }
, success: function (resp) {
qwery('#content').html(resp.content)
}
});
qiao.ajax({
url: 'path/to/data.jsonp?callback=?'
, type: 'jsonp'
, success: function (resp) {
qwery('#content').html(resp.content)
}
});
qiao.ajax({
url: 'path/to/data.jsonp?foo=bar'
, type: 'jsonp'
, jsonpCallback: 'foo'
, jsonpCallbackName: 'bar'
, success: function (resp) {
qwery('#content').html(resp.content)
}
});
qiao.ajax({
url: 'path/to/data.jsonp?foo=bar'
, type: 'jsonp'
, jsonpCallback: 'foo'
, success: function (resp) {
qwery('#content').html(resp.content)
}
, complete: function (resp) {
qwery('#hide-this').hide()
}
});
};
test();
qiao.cookie
'use strict';
var qiao = require('qiao.util.js');
var test = function(){
// set
qiao.cookie('name', 'value');
// get
console.log(qiao.cookie('name'));
// delete
qiao.cookie('name', null);
console.log(qiao.cookie('name'));
};
test();
qiao.qrcode
'use strict';
var qiao = require('qiao.util.js');
var test = function(){
// need <div id="qrcode" style="width:100px;height:100px;"></div>
// canvas
qiao.qrcode({
id : 'qrcode',
type: 'canvas',
text: 'http://insistime.com/'
});
// img
qiao.qrcode({
id : 'qrcode',
type: 'img',
text: 'http://insistime.com/'
});
// svg
qiao.qrcode({
id : 'qrcode',
type: 'svg',
text: 'http://insistime.com/'
});
};
test();
qiao.search
'use strict';
var qiao = require('qiao.util.js');
var test = function(){
// url http://www.baidu.com?q=1
var s = qiao.search('q');
// s = 1
console.log(s);
};
test();
version
0.1.7.20201023
- del qiao.indexeddb.js
- del qiao.ls.js
0.1.6.20200803
- ncu
0.1.5.20200630
- qiao.db.js@0.0.6
0.1.4.20200515
- add db
0.1.3.20200414
- add cache
0.1.2.20191204
- add funding
- update packagers
0.1.1.20190624
- add qiao.ls.js
- update npms
0.1.0.20190621
- add file type
0.0.9.20190605
- add vendor
0.0.8.20180720
- https homepage
0.0.7.20180719
- modify readme.md
0.0.6.20180319
- add qrcode keyword
0.0.5.20180318
- qiao.qrcode
0.0.4.20180313
- qiao.search
0.0.3.20180305
- modify md
0.0.2.20180301
- qiao.ajax
0.0.1.20180227
- init project
- qiao.cookie