JQuery 1.5 and new “Text JSON” datatype

前端 未结 3 402
说谎
说谎 2020-12-28 18:14

I have just updated to JQuery 1.5 and all my ajax calls that return JSON and a number of plugins instantly broke.

In my pre-1.5 code, I specified the dataType like:<

3条回答
  •  余生分开走
    2020-12-28 19:13

    Untested code, add this after jQuery is included, and before your custom code runs.

    jQuery.ajaxSetup({
      converters: {
        "json": jQuery.parseJSON,
        "* json": jQuery.parseJSON
      }
    });
    

提交回复
热议问题