I solve the problem now. I couldn't use elements in the onComplete.
Instead I had to use $$('a'). The whole code is far more complicated
than just this part but this will solve this problem.On Oct 9, 10:50 pm, zipz <[email protected]> wrote: > Yes my code was very ugly. I have a new link with correct > response.http://mooshell.net/FUGJg/ > The ajax request loads a link to google but that link should get > "addEvent('click', function(event).." In the event the link should be > stopped "event = new Event (event).stop();" and then an alert. The > problem is that the event never occurs. > > Thanks for your help. > > On Oct 9, 10:09 pm, Fábio M. Costa <[email protected]> wrote: > > > > > You need to have a valid code on your response, it seens like the site your > > trying to get the response haves an unclosed div. > > If you wanna get a whole site inside your site i would use an iframe. > > Ajax wont work cross-domain anyway. > > > -- > > Fábio Miranda Costa > > Solucione Sistemas > > Engenheiro de interface > > > On Fri, Oct 9, 2009 at 4:53 PM, Ryan Florence <[email protected]> wrote: > > > You've got a lot of whacky stuff going on in there and practically no > > > html, > > > and references to variables that don't exist anywhere (plus some binding?) > > > > You've got to be able to extract the basics of what you're trying to do > > > and > > > put that code up. You can't just post a mess like that and expect anybody > > > to know what you're trying to do :D > > > > Read the "Backend Support" section on the site so you can make real > > > requests. > > > > My code (http://mooshell.net/7Czz9/) does exactly what you want (I think.) > > > Study it and then try it yourself. > > > > On Oct 9, 2009, at 1:45 PM, zipz wrote: > > > > Try to get the alert.http://mooshell.net/de3My/ > > > > On Oct 9, 9:17 pm, Fábio M. Costa <[email protected]> wrote: > > > > zipz, Ryan just gave you a nice start, modify the code and show it to us > > > so > > > > we can help you. > > > > Thanks zalum for this great service (mooshell)! > > > > -- > > > > Fábio Miranda Costa > > > > Solucione Sistemas > > > > Engenheiro de interface > > > > On Fri, Oct 9, 2009 at 4:09 PM, Ryan Florence <[email protected]> > > > wrote: > > > > This might be helfpul: > > > >http://mooshell.net/Emrgv/ > > > > On Oct 9, 2009, at 12:43 PM, Fábio M. Costa wrote: > > > > Hi zipz, paste your code in mooshell.net and we can try to solve your > > > > problem. > > > > read the information you have on the menu to understand how the ajax > > > > requests work. > > > > Cheers, > > > > -- > > > > Fábio Miranda Costa > > > > Solucione Sistemas > > > > Engenheiro de interface > > > > On Fri, Oct 9, 2009 at 3:32 PM, zipz <[email protected]> wrote: > > > > I think my problem is something similar and I haven't found a solution > > > > either. I want to make some click events on the loaded elements in the > > > > requested. I get the responseElements in the onSuccess/onComplete > > > > function but the events aren't attached to the elements. I know it's > > > > because the domready isn't finished in the onSuccess/onComplete. > > > > I couldn't manage to get your code to work, Fábio. Aarons code became > > > > to complicated. > > > > This code works if I call the request from the content loaded within > > > > On Sep 26, 2:23 am, Pedro Moreira <[email protected]> wrote: > > > > Fábio, > > > > your code makes sense but I still can't make this work. Any ideia why? > > > > On Sep 25, 9:03 pm, Fábio M. Costa <[email protected]> wrote: > > > > I understand it, i had passed thought it before. > > > > The problem here is that the javascript is evaluated before the update > > > > is > > > > done, so you dont have the popup on the DOM and cant addEvents to it. > > > > Theres > > > > a way to do it, i dont like it but i'll show you as its the only i > > > > got. > > > > var editVenueBox = $('edit_venue_box'); > > > > new Request.HTML({ > > > > url: '/admin/venue/' + venue_id, > > > > evalScripts: false, > > > > onSuccess: function(responseTree, responseElements, responseHtml, > > > > responseJs){ > > > > editVenueBox.set('html', responseHtml); > > > > $exec(responseJs); > > > > } > > > > }).send(); > > > > Did you get it? Still i dont know why its done like this, shouldn't > > > > the > > > > order be changed (to the core-devs)? > > > > -- > > > > Fábio Miranda Costa > > > > Solucione Sistemas > > > > Engenheiro de interface > > > > On Fri, Sep 25, 2009 at 3:06 PM, Pedro Moreira < > > > > [email protected]>wrote: > > > > Hello everyone, > > > > I've been working on a really fun project but today something got on > > > > my nerves. I searched for some solutions but none worked for me. I > > > > even found one post somewhere with something similar: > > > >http://www.mooforum.net/general12/domready-after-request-html-t1743.html > > > > So... There's a page with a bunch of rows on a table and each row as > > > > a > > > > link "edit". On that page I add an event to each link when the user > > > > clicks on it. This event makes a Request.HTML and the html response > > > > will be set by the update option on a lightbox-like div, a better > > > > looking pop up window. On this new page I have some input fields and > > > > an input button which I want to be able to click to trigger an event > > > > (a request to save the input fields). > > > > Problem is: I can't add events on the pop up window! > > > > Code-wise: > > > > page.php > > > > ... > > > > window.addEvent('domready', function() > > > > { > > > > ... > > > > $each($$('a.edit_venue_link'), function(item) > > > > { > > > > item.addEvent('click', function() > > > > { > > > > var venue_id = item.get('venue_id'); > > > > new Request.HTML( > > > > { > > > > url: '/admin/venue/' + venue_id, > > > > update: 'edit_venue_box' > > > > }).send(); > > > > } > > > > ); > > > > } > > > > ); > > > > ... > > > > /admin/view/:num (it's a controller which triggers a view with...) > > > > ... > > > > <script> > > > > window.addEvent('domready', function() > > > > { > > > > alert($('submit_button').get('text')); > > > > $('submit_button').addEvent('click', function() > > > > { > > > > alert('is it working?'); > > > > }); > > > > ... > > > > The alert with the submit_button text works but all the events I try > > > > to add don't. > > > > Am I doing something wrong? > > > > I tried setting evalScripts true and false but it still doesn't > > > > work. > > > > The solution on the link I wrote about doesn't work either...
