Search and Top Navigation
#4076 closed bug (notabug)
Opened February 06, 2009 05:36PM UTC
Closed October 26, 2010 02:51AM UTC
Last modified October 03, 2012 04:54PM UTC
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: |
Description
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).
Attachments (0)
Change History (5)
Changed February 07, 2009 09:48PM UTC by comment:1
owner: | → klaus.hartl |
---|---|
status: | new → assigned |
Changed February 25, 2009 10:16PM UTC by comment:2
milestone: | TBD → 1.next |
---|
Changed July 30, 2010 08:35AM UTC by comment:3
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:
A. 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.
B. 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.
Giuliano
Changed October 26, 2010 02:51AM UTC by comment:4
resolution: | → invalid |
---|---|
status: | assigned → closed |
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.
Changed October 03, 2012 04:54PM UTC by comment:5
milestone: | 1.next → 1.6 |
---|