$$(selector).addEvent would add the event to all the items returned by the
selector.
On Thu, Dec 4, 2008 at 11:55 PM, Steve Onnis (via Nabble) <
[EMAIL PROTECTED]<[EMAIL PROTECTED]>
> wrote:
>
> $$('div#makeRequest a') would return an array so i would imagine it wouldnt
>
> be attaching the event properly
>
> try
>
> $('makeRequest').getElement('a').addEvent(.......
>
> -----Original Message-----
> From: [EMAIL
> PROTECTED]<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=1617341&i=0>
> [mailto:[EMAIL
> PROTECTED]<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=1617341&i=1>]
> On Behalf Of guillem
> Sent: Friday, 5 December 2008 6:06 PM
> To: MooTools Users
> Subject: Can't make HTML request to work
>
>
> Hi, i trying to make that code to work:
>
> HTML code :
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://
> www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"
> />
> <link rel="stylesheet" href="demo.css" type="text/css" />
> <script type="text/javascript" src="../mootools.js"></script>
> <script type="text/javascript" src="demo.js"></script>
> <title>Request.HTML Demo</title>
> </head>
> <body>
> <h1>Request.HTML</h1>
> <h2>Introduction</h2>
> <p>
> Request.HTML is a subclass of Request built for making XHR
> requests
> which return HTML content.
> </p>
> <p>
> <div id="makeRequest"><a href="data.html" rel="#" >Get
> HTML</a></
> div>
> </p>
> <h2>Result</h2>
> <div id="result">Waiting for the request to happen.</div>
> </body>
> </html>
>
> And the JS file:
>
> window.addEvent('domready', function() {
> // You can skip the following two lines of code. We need them to
> make
> sure demos
> // are runnable on MooTools demos web page.
> if (!window.demo_path) window.demo_path = '';
> var demo_path = window.demo_path;
> // --
>
> $$('div#makeRequest a').addEvent('click', function() {
> var testons = this.get('href');
>
>
> req.send();
> });
> //We can use one Request object many times.
>
> var req = new Request.HTML({url:demo_path+'myURL',
> onSuccess: function(html) {
> //Clear the text currently inside the results div.
> $('result').set('text', '');
> //Inject the new DOM elements into the results div.
>
> $('result').adopt(html);
> },
> //Our request will most likely succeed, but just in case,
> we'll add
> an
> //onFailure method which will let the user know what
> happened.
> onFailure: function() {
> $('result').set('text', 'The request failed.');
> }
> });
>
>
> });
>
> Do you guys have any ideas?
> By the way, i'm a total beginner.
>
> Thanks for all!
>
>
>
> ------------------------------
> View message @
> http://n2.nabble.com/Can%27t-make-HTML-request-to-work-tp1617261p1617341.html
> To start a new topic under MooTools Users, email
> [EMAIL PROTECTED]<[EMAIL PROTECTED]>
> To unsubscribe from MooTools Users, click here< (link removed) >.
>
>
>
-----
The MooTools Tutorial: http://www.mootorial.com www.mootorial.com
CNET Clientside: http://clientside.cnet.com clientside.cnet.com
--
View this message in context:
http://n2.nabble.com/Can%27t-make-HTML-request-to-work-tp1617261p1617372.html
Sent from the MooTools Users mailing list archive at Nabble.com.