Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ Add `db` to your dependencies section in `kanso.json`.

> run `kanso install` to fetch the package

You also need __jQuery__ to be included on your page, since this module uses
jQuery.ajax to make requests.


### Events

The db module is an EventEmitter. See the
Expand Down
11 changes: 6 additions & 5 deletions db.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@


var events = require('events'),
_ = require('underscore')._;
_ = require('underscore')._,
jQuery = require('jquery');


/**
Expand Down Expand Up @@ -62,17 +63,17 @@ var httpData = function (xhr, type, s) {
data = xml ? xhr.responseXML : xhr.responseText;

if (xml && data.documentElement.nodeName === "parsererror") {
$.error("parsererror");
jQuery.error("parsererror");
}
if (s && s.dataFilter) {
data = s.dataFilter(data, type);
}
if (typeof data === "string") {
if (type === "json" || !type && ct.indexOf("json") >= 0) {
data = $.parseJSON(data);
data = jQuery.parseJSON(data);
}
else if (type === "script" || !type && ct.indexOf("javascript") >= 0) {
$.globalEval(data);
jQuery.globalEval(data);
}
}
return data;
Expand Down Expand Up @@ -257,7 +258,7 @@ exports.stringifyQuery = function (query) {
exports.request = function (options, callback) {
options.complete = onComplete(options, callback);
options.dataType = 'json';
$.ajax(options);
jQuery.ajax(options);
};


Expand Down
3 changes: 2 additions & 1 deletion kanso.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"dependencies": {
"modules": null,
"underscore": ">=1.1.5",
"events": null
"events": null,
"jquery": null
}
}