473,692 Members | 2,105 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

render :update returns js wrapped in a HTML body

1 New Member
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 javascriptGener ator 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?p id=50104#p50104
Jan 8 '08 #1
1 7616
improvcornartist
303 Recognized Expert Contributor
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
1803
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 System.Web.UI; public class PageBase : System.Web.UI.Page {
1
2168
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 being called by the asp.net enginge ??? To be more specific, the thing I currently am most interested in understanding is from which method in the Page class you can know that that the Render method of all aggregated controls have been called...
4
4219
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 the server generates the HTML based on a passed in parameter. In our case, CustomerID. Every Customer ges a branded website with there logos and webpage etc.. To Avoid having 1 ASP.Net application running for each client I am attempting a more...
5
1774
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
5164
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" The user control has this button on its page. I am outputing the <form runat="server"> inside the render method and have also tried adding it to the page and to the control without any luck. Any help appreciated.
1
4105
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: I dynamically add an htmlcheckbox to a webform in the pages render and set the checked value to true. When the page loads, if I remove the check from the checkbox and then submit it, in the submit event the checkbox' checked value is still...
7
2447
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 rendered as a page (or actualy a part of a page) that is editiable. To do this I let the user download the document, edit it and then upload it back to the site. Then at Page_Open, I convert the .doc file to an html and render it back to the page......
13
3544
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 some javascript code that calls window.open. I pass the resource url of page B to Page A's window.open call. Page B is then loaded and executed but none of the server-side code is rendered. If I view the source of the page, the code (and page...
1
2411
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 modify it for use in my own database. It almost works for me LOL. contact.php returns my dive buddies first and last name and gives me the option to either Edit or Delete them. Currently the delete option is not active. When I choose to edit...
0
8535
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8954
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8794
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8796
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6458
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5817
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4322
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4555
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2234
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.