Opened 17 years ago
Closed 16 years ago
#955 closed bug (worksforme)
$ajax({dataType: 'html' (but should be 'script') .... works in safari, but not ff
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | trivial | Milestone: | 1.1.4 |
Component: | ajax | Version: | 1.1.3 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description (last modified by )
Here is my code:
function related_stories_new_page(url, page){
jq.ajax({
dataType: 'html', url: url, data: 'page=' + page, success: function(res){eval(res);}, error: function(){alert('could not retrieve the new page.');} });
return false;
}
The code should be:
function related_stories_new_page(url, page){
jq.ajax({
dataType: 'script', url: url, data: 'page=' + page, success: function(res){eval(res);}, error: function(){alert('could not retrieve the new page.');} }); return false;
}
because the call returns javascript, not html.
When the incorrect dataType is present (first function), Safari will eval the js that is returned anyways, while Firefox will do nothing.
The behavior should be consistent.
They both behave the same with the second function.
Change History (2)
comment:1 Changed 16 years ago by
comment:2 Changed 16 years ago by
Description: | modified (diff) |
---|---|
Milestone: | → 1.1.4 |
need: | → Review |
Resolution: | → worksforme |
Status: | new → closed |
Version: | 1.1 → 1.1.3 |
Are you saying that FF doesn't eval the response even though you're explicitly invoking eval yourself? I've tried to duplicate this but I can't. In the script below, FF is correctly evaling the text in may1.txt.