Skip to main content

Bug Tracker

Side navigation

#1432 closed enhancement (fixed)

Opened July 28, 2007 03:05PM UTC

Closed June 15, 2010 02:17AM UTC

jQuery json

Reported by: hobbit Owned by:
Priority: major Milestone: 1.1.4
Component: ajax Version: 1.1.3
Keywords: Cc:
Blocked by: Blocking:
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.

Attachments (0)
Change History (1)

Changed June 15, 2010 02:17AM UTC by dmethvin comment:1

resolution: → fixed
status: newclosed

This was implemented in 1.4.