Hello there,
I have a clients controller, and I want it to respond both ajax and html
to the new action.
If the user uses the html action, the new partial is going to be
rendered and all works with no problem.
In oder hand, if a ajax request is submitted, everything renders ok (it
will be rendered inside a div in the index page), but some JS functions
don't.
I have this piece of code in my view:
-----------------
<% templates = "var phone_template='#{generate_template(contact_form,
:phones, :partial => "/contacts/phones/create")}'" -%>
<%= javascript_tag(templates) -%>
-----------------
What will generate a script tag in the html file (if is called normally,
html request), or the result is passed to the page (using ajax), and it
can be visualized using firebug.
This code (in the same view, on the botton):
<%= link_to 'Adicionar Telefone', '#phone_template', :class =>
"add_nested_item", :rel => "contact_phones" %>
Calls a function (evnt: onclick, function: add_nested_item) that is
declared in the application.js file.
I have narrow the error down, and I thing that (pretty sure) that the
function "add_nested_itme" cant find the js var "phone_template".
What can be done to solve this problem.
Regards,
David Sousa
Ps: Any extra code will be given if needed.
Application.js => http://pastie.org/555701
Partial (view) => http://pastie.org/555708
Result of javascript_tag => http://pastie.org/555714
--
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---