Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var AjaxRequest = function (url) {
- this.opts = {
- 'url': url,
- 'method': 'GET',
- 'data': {},
- 'dataType': 'json',
- 'headers': {},
- 'cache': true,
- 'crossDomain': true,
- 'success': function () {},
- 'error': function (jqXHR, textStatus, errorThrown) {
- console.log(jqXHR, textStatus, errorThrown);
- },
- 'complete': function () {},
- 'beforeSend': function () {}
- };
- }
- AjaxRequest.prototype.setOption = function(name, value) {
- this.opts[name] = value;
- return this;
- }
- AjaxRequest.prototype.send = function () {
- jQuery.support.cors = true
- return $.ajax(this.opts);
- };
- var request = new AjaxRequest("http://");
- request.send();
Advertisement
Add Comment
Please, Sign In to add comment