473,410 Members | 1,977 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,410 software developers and data experts.

render :update returns js wrapped in a HTML body

1
render :update returns js wrapped in a HTML body

Hi.

From what I'm learned the below is suppose to return "alert('Im JS');"
to the javascriptGenerator that's suppose to make the page scream 'Im
JS'...(?)


1. render :update do |page|
2. page.call :alert, "Im JS"
3. end

In Rails 1.2.3 it works perfectly.

BUT in Rails 2.0.2 it returns the js neatly wrapped in a full HTML-body,
and the browser shows me nada... (!)

Please help me here, I've tried everything I can think of for hours now!

Random things I've tryed (not in any order, and just glimpses)
use the page/hi.js.rjs approach


1. :text => "alert('Im JS');", :content_type => "text/javascript"

1. respond_to do |format|
2. format.js
3. end

1. headers["Content-Type"] = "text/javascript; charset=utf-8

1. render :update, :layout => false, :content_type => "text/javascript" do
2. |page|
3. page.call :alert, "Im JS"
4. end

Thank you all in advance!
//Nicklas Ramhöj


Below is my environment:

2. Ruby version 1.8.6 (i686-darwin8.9.1)
3. RubyGems version 1.0.1
4. Rails version 2.0.2
5. Active Record version 2.0.2
6. Action Pack version 2.0.2
7. Active Resource version 2.0.2
8. Action Mailer version 2.0.2
9. Active Support version 2.0.2
10. Environment development
11. Database adapter mysql
12.
13. Mac OS X Leopard
14. Firefox 2.0.0.11
15. Safari 3.0.4

This thread can also be found at: http://www.ruby-forum.com/topic/138029#614027 and http://railsforum.com/viewtopic.php?pid=50104#p50104
Jan 8 '08 #1
1 7605
improvcornartist
303 Expert 100+
I don't know about Rails 2.0.2, but in Rails 1.2.3
Expand|Select|Wrap|Line Numbers
  1. render :update do |page|
  2.   page << "alert('Im JS')"
  3. end
writes the raw JavaScript to the page.
Jan 9 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: boy | last post by:
Hi all, I have created a simple template class as follow, but i encountered memory leakage on the base.Render(writer). Have all you of encountered the same problem? using System; using...
1
by: Tomas | last post by:
Is there any sequence diagram on the web that clearly shows in which order all Page methods (load, render and so on) are being called compared to the order the page's contained control methods are...
4
by: Zuel | last post by:
Hi Folks. So I have a small problem. My DoPostBack function is not writen to the HTML page nor are the asp:buttons calling the DoPostBack. My Goal is to create a totaly dynamic web page where...
5
by: sk | last post by:
Hi, I'm trying to override the Render method of my Page class. Are there any standard guidelines for this? Thanks. Shardul
3
by: John Hughes | last post by:
I'm trying to add a user control to a form via the pages render method and I get the following error : "Control 'Button1' of type 'Button' must be placed inside a form tag with runat=server" ...
1
by: Kevin R | last post by:
This is one of the weirdest problems I have ever run into. I have had to trim down a bunch of code to give a sample that is more easily readable by those who will view this. Here is the problem:...
7
by: SteveM | last post by:
I am sure this is an easy question, but being relatively new to ASP.NET programming, I can not quite grasp what I need to accomplish what I need to do. What I have is a word document that is...
13
by: Bob Jones | last post by:
Here is my situation: I have an aspx file stored in a resource file. All of the C# code is written inline via <script runat="server"tags. Let's call this page B. I also have page A that contains...
1
by: Markw | last post by:
Hi folks I think I've got a variable problem but not 100% sure. Background: I took the CMS example from chapter 6 in "Build your Own Database Driven Website Using PHP&MySQL" and have attempted to...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.