Opened 14 years ago

Closed 12 years ago

Last modified 10 years ago

#4076 closed bug (notabug)

Response evaluation does not respect dataType option

Reported by: warhammerkid Owned by: klaus.hartl
Priority: minor Milestone: 1.6
Component: ui.tabs Version: 1.6rc6
Keywords: Cc:
Blocked by: Blocking:


Steps to Reproduce:

  1. Initialize tabs with ajaxOption {dataType:"script"}
  2. Load tab which returns pure script

Expected Result: The script is run and it populates the tab

Actual Result: The script text is inserted into the tab body

Additional Information: I noticed that in ticket #3085 you stated that the response should be HTML and that you wouldn't change handling of it, but I still feel that if the user sets the dataType option to, for example, "script", the handling of the response should be different. If the user sets the dataType ajax option to something other than HTML, it should be assumed that they had a good reason to do so, instead of saying that if they can't return HTML that's too bad. I don't really know how it would work for data types other than script, but for script, it's a simple matter of not running $(self._sanitizeSelector(a.hash)).html(r).

Change History (5)

comment:1 Changed 14 years ago by klaus.hartl

Owner: set to klaus.hartl
Status: newassigned

comment:2 Changed 14 years ago by klaus.hartl


comment:3 Changed 13 years ago by giuliano.losi

I have the same problem, but with xml dataType. The site returns a xml with metadata and a payload to elaborate on prelaod. I have explored the code and I have found that $(self._sanitizeSelector(a.hash)).html(r) it's runned before every callback method. In my opinion this is wrong. The possible solutions are two:

  1. Change the declaration of xhr in load method: invert the second with third parameter of $.extend. This change allows you to override the default ajaxOptions and its frees developers to develop their own code. It is a big change that does not maintain backward compatibility.
  2. Add "prelaod" callback function to produce the result (r) before the call of $(self._sanitizeSelector(a.hash)).html(r). The code might look like this:

callbacks r = self._trigger('preload', null, [...]); $(self._sanitizeSelector(a.hash)).html(r);

I don't know which of the two is better, but I prefer the first.

Sorry for my bad english and thank for your great work.


comment:4 Changed 12 years ago by Scott González

Resolution: invalid
Status: assignedclosed

As previously stated, we don't want to support this. If you really need to make this work, you should be able to do with with the available events.

comment:5 Changed 10 years ago by Scott González

Milestone: 1.next1.6
Note: See TracTickets for help on using tickets.