Quite a few people have noticed a parse error with json in the new jQuery 1.5 -- just check out google. Most of the responses suggest that it is due to a conflict with jQuery Validate. However, I think that something changed in the JSON parser.
I fixed the problem on my site by adjusting the drupal_json method to encode strings differently. The old encoding method worked fine with jquery 1.3, but it broke with jquery 1.5.
The relevant code that does not work with jquery 1.5 (see "drupal_to_js()"):
return '"'. str_replace(array("\r", "\n", "<", ">", "&"), array('\r', '\n', '\x3c', '\x3e', '\x26'), addslashes($var)) .'"';
The revised code that does work with jquery 1.5:
This simply pushes the encoding logic down a level to a built-in PHP function, which is well-tested by a broader audience. However, I have not tested enough to confirm whether it has made a material change in meaning. Regardless, it leads me to a conclusion that either Drupal was okay and the new JSON parser is broken, or that Drupal was broken and the old JSON parser was simply more forgiving.
In Drupal 7, they also use json_encode() rather than the addslashes() function. See the updated equivalent to drupal_to_js().
drupal_json()in several places, including filefield and CCK. While this does not seem like a bug, it is another instance where the updated version is less forgiving.
While drupal_json() worked well for most AJAX requests, IE did not like that as a header when the AJAX used the POST method. Thus, I now use the following drupal_json() and drupal_to_js() functions from common.inc with jQuery 1.5: