Render_to_string + json problem

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs