Hi, I am verry new to prototype and ajax. This on of my first tests. It works great.. only the javascript that got loaded by ajax doesn't execute.. And when I click on the button that is loaded with ajax it get: test2 is not defined.. What am I doing wrong? from http://prototypejs.org/learn/introduction-to-ajax <cut>this module also deals in a smart way with JavaScript</cut> So I must be doing something wrong? TIA, Jan My code: _______________________________________ test1.htm _______________________________________ <html> <head><TITLE>AJAX TEST</TITLE></head> <body> <script src="/javascript/scriptaculous/prototype.js" type="text/ javascript"></script> <script language="javascript"> function ajax_onsuccess(transport){ var response = transport.responseText || "no response text"; document.getElementById('newContent').innerHTML = response; } function ajax_onfailure(){ alert('Something went wrong'); } function btnOnclick(object){ new Ajax.Request( 'test2.htm', { method:'get', onSuccess: ajax_onsuccess, onFailure: ajax_onfailure } ) } </script> <button onclick="btnOnclick(this)">ajaxTest</button> <div id="newContent"> </div> </body> </html> _______________________________________ test2.htm _______________________________________ <button id="button" onclick="test2();">test</button> <script language="javascript"> document.getElementById('button').innerHTML = 'TEST2'; function test2(){ document.getElementById('button').innerHTML = 'TEST3'; } </script>
--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
