When I try to update content through ajax It doesn''t work on Safari.
I''ve opened a ticket http://dev.rubyonrails.org/ticket/7087 for full
reference. The test case is the next:
/app/controllers/problem_controller.rb
class ProblemController < ApplicationController
def index
render :action => ''index''
end
def myrequest
render(:update) {|page| page.updateContent(params[:content])}
end
end
/app/controllers/problem_helper.rb
module ProblemHelper
def updateContent(content)
page.replace_html ''content'', content
end
end
/app/views/problem/index.rhtml
<html>
<head>
<%= javascript_include_tag :defaults %>
<script language="javascript" type="text/javascript">
var Site = {
loader: function(){
new Ajax.Request(''/problem/myrequest'',{
postBody:''content=this is a test'',
method:''post'',
asynchronous:true,
evalScripts:true,
onFailure: function(transport) {
$(''content'').innerHTML=transport.responseText;
},
onComplete: function(transport){
alert(transport.responseText);
}
});
}
}
Event.observe(window,''load'', function(){Site.loader()});
</script>
</head>
<body>
<div id="content"></div>
</body>
</html>
I''m pretty sure that this works but only in gecko engines and IE. I was
debugging the prototype.js and I realized using
response.getAllResponseHeaders() function that Safari and Swift are not
passing the headers therefore since the line 766 in prototype.js It''s
not executed:
if ((this.header(''Content-type'') ).match(/text\/javascript/i))
this.evalResponse();
By the way, for other example of this problem take a look at
devjax.com, It''s my site and has the same problem!
Many thanks for helpping :(
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---