You need to know the flow first

if u write .erb file it will execute by interpreter and only html response
will served to client side browser .

But you are trying to execute the ruby code from javascript which will not
possible. so it is considering as text and displaying that.

anyway request is going to server, so my advise is run the required ruby
code on server and the response html will be served to you

for that you need to create the request_getting_method.js.erb on server and
place your code on that like this

$("#image_center").html("<%=escape_javascript(render(:partial =>
'pages/top_link')) %>");

so that will execute on server and gives responce to client and the
responce will replace by image_cente id element html content.



On 7 August 2012 19:09, Walter Lee Davis <wa...@wdstudio.com> wrote:

>
> On Aug 7, 2012, at 7:03 AM, Manish Nautiyal wrote:
>
> > I'm using rails 3.2.1 with jquery for an ajax call.
> >
> > My juqery code is :
> >
> > jQuery.ajax({
> >                url: "/org_pages",
> >                data: 'org_id='+ org_id,
> >                type: "POST",
> >                success: function(result){
> >                    jQuery("#image_center").html("<%=
> > escape_javascript(render(:partial => 'pages/top_link')) %>");
> >                },
> >                error: function(){
> >                    alert('Error occured');
> >                }
> >            });
> >
> > My problem is on the web page the output is showing this :
> >
> > <%= render :partial => 'pages/top_link', :collection=>@pages %>
> >
> > How it should display my render partial page. :(
>
> What is the file-extension of the script you posted? Does it include .erb
> as the last segment? If not, then the erb code won't be evaluated at all.
>
> Walter
>
> >
> > --
> > 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@googlegroups.com.
> > To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com.
> > For more options, visit https://groups.google.com/groups/opt_out.
> >
> >
>
> --
> 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@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>


-- 
-------------Regards---------------
G SubbaRao
Cell:08970668850
E-Mail:subbarao....@gmail.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@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to