[development] FWIW: using jQuery 1.4.2 (and jQuery-UI 1.8.2)

Earl Miles merlin at logrus.com
Fri Aug 27 04:21:57 UTC 2010


On 8/26/2010 4:12 PM, Rob Koberg wrote:
> 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?

Yes.

http://drupal.org/node/479368#comment-3198886


More information about the development mailing list