You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to rubyonra...@googlegroups.com
It's not at all clear to me what you are asking, but remember:
- Ruby runs on the server;
- Javascript runs in the browser.
- Sometimes Ruby on the server is used to create/modify Javascript to be run in the browser.
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to rubyonra...@googlegroups.com
hi
here i have mention example code
<script type="text/javascript">
var js_name="daya";
<%=@user=User.where("name=?", js_name%>
alert("<%=@user%>");
</script >
Walter Lee Davis
unread,
Nov 13, 2013, 9:45:23 AM11/13/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to rubyonra...@googlegroups.com
If you're going to use Erb in your JavaScript, then you must name your file whatever.js.erb. Then your <%= %> will expand to be whatever the local value of @user is at the moment that script is requested. You will need a controller, too, and your request will need to have some context around it. If your controller had a respond_to block in it, and your JavaScript file was named sensibly for the controller method, then this would Just Work™,
respond_to do |format|
format.js { render :layout => false }
format.html
end
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to rubyonra...@googlegroups.com, Daynthan Kabilan
On Nov 13, 2013, at 7:40 AM, Daynthan Kabilan <dayan...@gmail.com> wrote:
> here i have mention example code
OK, evaluate that code in light of what I said previously:
- Ruby runs on the server;
- Javascript runs in the browser.
Now:
1) What do you think that code will do???
2) What are you actually trying to accomplish?
Colin Law
unread,
Nov 13, 2013, 9:55:03 AM11/13/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to rubyonra...@googlegroups.com
On 13 November 2013 14:40, Daynthan Kabilan <dayan...@gmail.com> wrote:
> hi
>
> here i have mention example code
>
> <script type="text/javascript">
>
> var js_name="daya";
>
> <%=@user=User.where("name=?", js_name%>
Remember the above is evaluated on the /server/ before the page is
rendered. js_name is not meaningful at that time.