Rein Henrichs
2008-Jul-30 18:55 UTC
Re: jQuery.post gets some code but the code isn''t evaluated
> jQuery.post("/plans/<%= @plan.id %>/add_learning_objective?name=" + > objective_name)You need to specify the type option as "script" to have it executed. (See the docs for jQuery.ajax(), where it is the dataType option. The "type" option in $.post is passed to $.ajax as the dataType option) Rein --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Max Williams
2008-Jul-31 09:33 UTC
Re: jQuery.post gets some code but the code isn''t evaluated
Thanks Rein, that was exactly it: using .ajax instead of .post worked
perfectly:
//doesn''t evaluate the response, ie doesn''t run the javascript
in my
.js.rjs file
jQuery.post("/plans/<%= @plan.id
%>/add_learning_objective?name=" +
objective_name);
//this works
jQuery.ajax({
type: "POST",
url: ("/plans/<%= @plan.id %>/add_learning_objective?name=" +
objective_name),
dataType: "script"
})
Thanks again
max
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---