Skip to content

Commit

Permalink
v0.0.10
Browse files Browse the repository at this point in the history
  • Loading branch information
codebykenny committed Feb 25, 2015
1 parent e3f4a4e commit 2dd4e7b
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 18 deletions.
15 changes: 10 additions & 5 deletions dist/z.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/*!
* z.js JavaScript Library v0.0.9
* z.js JavaScript Library v0.0.10
* https://github.com/NEURS/z.js
*
* Copyright 2015 NEURS LLC, Kevin J. Martin, and other contributors
* Released under the MIT license
* https://github.com/NEURS/z.js/blob/master/LICENSE
*
* Date: 2015-02-02T21:24Z
* Date: 2015-02-25T21:45Z
*/
;(function (window, document) {

Expand Down Expand Up @@ -131,16 +131,21 @@ z.ajax = function (options) {
req.onload = function () {
var resp;

resp = ajaxTypes[options.responseType].call(req, req.responseText, true);

if (req.status >= 200 && req.status < 400) {
resp = ajaxTypes[options.responseType].call(req, req.responseText, true);
options.success.call(options.context, resp);
} else {
options.error.call(options.context, req.status, req.statusText);
options.error.call(options.context, resp, req.status, req.statusText);
}
};

req.onerror = function () {
options.error.call(options.context, req.status, req.statusText);
var resp;

resp = ajaxTypes[options.responseType].call(req, req.responseText, true);

options.error.call(options.context, resp, req.status, req.statusText);
};

if (!~["HEAD", "GET"].indexOf(options.method.toUpperCase())) {
Expand Down
2 changes: 1 addition & 1 deletion dist/z.min.js

Large diffs are not rendered by default.

17 changes: 11 additions & 6 deletions dist/z.sm.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/z.sm.min.js

Large diffs are not rendered by default.

11 changes: 8 additions & 3 deletions lib/ajax.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,21 @@ z.ajax = function (options) {
req.onload = function () {
var resp;

resp = ajaxTypes[options.responseType].call(req, req.responseText, true);

if (req.status >= 200 && req.status < 400) {
resp = ajaxTypes[options.responseType].call(req, req.responseText, true);
options.success.call(options.context, resp);
} else {
options.error.call(options.context, req.status, req.statusText);
options.error.call(options.context, resp, req.status, req.statusText);
}
};

req.onerror = function () {
options.error.call(options.context, req.status, req.statusText);
var resp;

resp = ajaxTypes[options.responseType].call(req, req.responseText, true);

options.error.call(options.context, resp, req.status, req.statusText);
};

if (!~["HEAD", "GET"].indexOf(options.method.toUpperCase())) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "z.js",
"version": "0.0.9",
"version": "0.0.10",
"description": "Simple DOM Manipulator",
"main": "",
"scripts": {
Expand Down

0 comments on commit 2dd4e7b

Please sign in to comment.