Welcome to AsyncRequest Demo Pages.
This is very simple plugin, we just gathered all steps of a asyncrequest (ajax request).
Step 1. Request
To request by plugins, you can use webApi like
$.asyncRequest.get() //ajax request with Get
$.asyncRequest.post() //ajax request with Post
$.asyncRequest.put() //ajax request with Put
$.asyncRequest.delete() //ajax request with Delete
All parameters to request see Options to use
var dataRequest = {};//Object with information to request
var options = {};extra behavior, like notification and block....
$.asyncRequest.get(dataRequest, options)
//Sample
request.post({
Url: 'urlRequest'
, Data: {}//object to send
, ContentType: "application/json; charset=utf-8"
, DataType: "json"
}
, {
notification: {
notificationSuccessMsgDefault: "Custom Mensage"
, notificationErrorMsgDefault: "Custom Mensage error"
}
});
Step 2. block page (optional)
When you make ajax request, we block element or page using BlockUI plugin
$.asyncRequest.get({Containner: null}) //default value, block all Page
$.asyncRequest.get({Containner: false}) //disable block
$.asyncRequest.get({Containner: '#blockPrecode'}) //block element
$.asyncRequest.get({Msg: 'Custom Message'}) //custom message
Step 3. Success/Error/Complete result
after request we call "result" function, aka Success or Error
//define success function
$.asyncRequest.get({ Url: 'XXXX', SuccessFunction: function () { } })
//define success and error function, but only succes will fire
$.asyncRequest.get({ Url: 'XXXX', SuccessFunction: function () { }
, ErrorFunction : function() { } })
//error will fire
$.asyncRequest.post({ Url: 'XXXX', SuccessFunction: function () { }
, ErrorFunction : function() { } })
//define complete function
$.asyncRequest.get({ Url: 'XXXX', SuccessFunction: function () { }
, CompleteFunction: function () { } })
Step 4. Feed back result
After a success/error request and all process execute will be nice show to user a feddback. to show notification we use jGrowl plugin
in Get request we dont show notification by default, see notification options page
//success notification
$.asyncRequest.post({ Url: 'http://headers.jsontest.com/' })
//error notification
$.asyncRequest.post({ Url: 'http://xxx.com' })
//disable notification
$.asyncRequest.post({ Url: 'http://headers.jsontest.com/'}
, {notification: {notifyFunction: false} })
Authors and Contributors
Support or Contact
Having trouble with Pages? Check out the documentation at https://github.com/Taguiar84/AsyncRequest/blob/master/HowToUse.md and we’ll help you sort it out.