[development] FWIW: using jQuery 1.4.2 (and jQuery-UI 1.8.2)
Rob Koberg
rob at koberg.com
Thu Aug 26 23:12:42 UTC 2010
Hi,
I want/need to use jQuery 1.4.2 mostly because of the 'live' method
(http://api.jquery.com/live/). This works fine for the most part. So
far the only problem has been with Chaos Tools ajax-responder.js and
the Page Manager. Even though ajax POST in
Drupal.CTools.AJAX.clickAJAXLink returns with a status 200, the error
handler is called. This is because the JSON returned is not valid and
causes jQuery-1.4.2 to fail and produce the error (in 1.4.2 parseJSON
needs a completely valid JSON string).
To fix this I send the error call to the same handler for success
(Drupal.CTools.AJAX.respond). I need to change the function to eval
the responseText.
Drupal.CTools.AJAX.respond = function(data) {
if (data.responseText) {
data = eval('(' + data.responseText + ')');
}
for (i in data) {
if (data[i]['command'] &&
Drupal.CTools.AJAX.commands[data[i]['command']]) {
Drupal.CTools.AJAX.commands[data[i]['command']](data[i]);
}
}
};
Is there a better way to handle this?
best,
-Rob
More information about the development
mailing list