Permalink
Browse files

Merge pull request #4 from BrynM/master

Fix for canceling refresh by calling Paging.setOptions() to clear out refresh.url during onRefresh().
  • Loading branch information...
2 parents 5b2856b + 717148f commit 2d67b2ff03450b636c7b0f1f010f69cab8561775 @infusion committed Apr 10, 2012
Showing with 10 additions and 7 deletions.
  1. +10 −7 jquery.paging.js
View
@@ -208,20 +208,23 @@
this.opts["perpage"] = 10;
}
- if (this.opts["refresh"]["url"]) {
+ if (this.interval) window.clearInterval(this.interval);
- if (this.interval) window.clearInterval(this.interval);
+ if (this.opts["refresh"]["url"]) {
this.interval = window.setInterval(function(o, $) {
$["ajax"]({
"url": o.opts["refresh"]["url"],
"success": function(data) {
-
- try {
- var tmp = $["parseJSON"](data);
- } catch (o) {
- return;
+ if (typeof(data) == "object") {
+ var tmp = data;
+ } else {
+ try {
+ var tmp = $["parseJSON"](data);
+ } catch (o) {
+ return;
+ }
}
o.opts["onRefresh"](tmp);
}

0 comments on commit 2d67b2f

Please sign in to comment.