I am stucked at some major issue with the AjaxForm and render_to_string.
I am using AjaxForm for uploading images with other details since the Ajax
Upload library isn''t even using Ajax. So once the form is submitted i
need
to call a partial and return it in a json format. but the problem is that
the render_to_string is not working at all. In case if i am returning simple
string then it''s working fine.
reference http://jquery.malsup.com/form/#file-upload
#server Ruby on rails
def some_action
respond_to do |format|
@html = render_to_string(:partial => "form.html.erb", :object
=> [@obj1,
@obj2])
json = { :success => "Added successfully", :html => @html }
format.html { render :json => json }
end
end
#client side
$("#upload").ajaxForm({
dataType: "json",
success: function(response) {
console.log(response);
console.log(response.html);
});
return false;
});
Thanks for any help
Abhis
--
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.