Modify ↓
Ticket #1432 (closed enhancement: fixed)
jQuery json
| Reported by: | hobbit | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | 1.1.4 |
| Component: | ajax | Version: | 1.1.3 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
We modified the httpData method to can parse the json object with $.json object if exists and can get the x-json header.
.httpData : function( r, type ){
var ct = r.getResponseHeader("content-type"),
data = (type=="xml || (!type && ct && ct.indexOf("xml") >= 0)?
r.responseXML:r.responseText;
switch (type){
case "script":
jQuery.globalEval( data );
break;
case "json":
data = r.getResponseHeader('X-JSON') || data;
data = $.JSON? $.JSON.parse(data):eval("(" + data + ")");
break;
case "html":
jQuery("<div>").html(data).evalScripts();
break;
}
return data;
}
The modified script explains the x-json header like prototype library, and we can use the JSON plugin if it is defined.
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

This was implemented in 1.4.