Browse files

Improved error reporting

  • Loading branch information...
1 parent 1c90854 commit 7c615941875bd1dea83913f9f6493eacf9dced60 @miohtama miohtama committed Oct 1, 2012
Showing with 17 additions and 1 deletion.
  1. +17 −1 src/collective/z3cform/dgftreeselect/static/main.js
View
18 src/collective/z3cform/dgftreeselect/static/main.js
@@ -67,7 +67,10 @@
return;
}
+ // Check if we do hidden inits
if(!hidden) {
+
+ // Wait until visible and poll back
if(!elem.is(":visible")) {
this.tryInitLater(elem);
return;
@@ -95,6 +98,11 @@
elem.delegate(".dgf-tree-select-widget", "change", $.proxy(self.handleSelect, self));
}
+ // JSON data reading over AJAX failed
+ function fail(data) {
+ window.console.error("Could not initialize:" + url);
+ }
+
// Check if we already have the tree data from this URL loaded on the same page
var data = this.dataCache[url];
@@ -108,8 +116,16 @@
field.prepend(ajaxLoader);
elem.hide();
-
$.getJSON(url, got);
+
+ $.ajax({
+ url: url,
+ dataType: 'json',
+ data: null,
+ success: got,
+ error : fail
+ });
+
}
},

0 comments on commit 7c61594

Please sign in to comment.