yeah I'm now trying to do something more along the lines of what you
suggested with jquery's $.ajax function. Almost there for the most part.
Thanks for your suggestions
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups Ruby
Hi, I'm trying to get my javascript to execute after clicking a link on
my page using :format = js here's my link:
%= link_to image_tag(/images/icons/user_add.png),
add_contact_path(:profile_id = profile.id, :url = request.url, :format
= js), :title = Add person to your contacts%
in my
Generating JavaScript dynamically with ERb is almost never a good thing
in my experience. Make your JavaScript static by getting the profile_id
from the DOM or a URL parameter.
Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org
Well, there's some code inside the
def add_contact
@contact = Contact.new(:user_id = current_user.id, :profile_id =
params[:profile_id])
if @contact.save
flash[:notice] = Successfully added contact.
redirect_to params[:url]
else
flash[:error] = Could not add contact.
redirect_to params[:url]
end
end
That's
Yeah, that's what I need. The problem here, as stated in the original
post, is the javascript code in my add_contact.js.erb is being displayed
as text and not executed when it gets routed through format.js. Just
wondering how to make that code execute. I'm trying now to do it through
jquery
Well I finally figured this out on my own if anyone else reads this. My
solution was as follows:
%= text_field_with_auto_complete :profile, :lastname, {},
{:url={:action='auto_complete_for_profile_lastname', :conference_id =
@conference.id}}%
By changing the url, I was able to pass a
6 matches
Mail list logo