Bug Tracker

Modify

Ticket #1432 (closed enhancement: fixed)

Opened 7 years ago

Last modified 4 years ago

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

comment:1 Changed 4 years ago by dmethvin

  • Status changed from new to closed
  • Resolution set to fixed

This was implemented in 1.4.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.