Skip to content

@naholyr /es5.js
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Object destructuring for function parameters
function ajax(options) {
options = Object.extend({
"method": "POST",
"error": function() {},
"success": function() {},
// ...
}, options || {})
try {
return options.success(net(options.url, options.method))
} catch (err) {
return options.error(err)
}
}
function ajax({
"url": url,
"method": method = "POST",
"error": error = function() {},
"success": success = function() {}
}) {
try {
return success(net(url, method))
} catch (err) {
return error(err)
}
}
ajax({ "url": urlToService, "method": "GET" })
@bricecarpentier
function ajax(options) {
    options = options || {};
    var url = options.url;
    var method = options.method || 'POST';
    var error = options.error || function() {};
    var success = options.success || function() {};

    try {
        return success(net(url, method));
    } catch (err) {
        return error(err);
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.