What are you trying to do? That code should work fine in web2py, as it's just Javascript. You just need to have it call a web2py URL. Of course, web2py includes some built-in mechanisms for handling Ajax requests, such as the ajax() Javascript function and the LOAD() helper to create Ajax components.
Anthony On Tuesday, June 4, 2019 at 3:23:11 PM UTC-4, Ben Duncan wrote: > > Ok, the following is code from w3 schools: > https://www.w3schools.com/js/js_ajax_intro.asp > > The code is as follows : > > <!DOCTYPE html> > <html> > <body> > > <div id="demo"> > <h2>The XMLHttpRequest Object</h2> > <button type="button" onclick="loadDoc()">Change Content</button> > </div> > > <script> > function loadDoc() { > var xhttp = new XMLHttpRequest(); > xhttp.onreadystatechange = function() { > if (this.readyState == 4 && this.status == 200) { > document.getElementById("demo").innerHTML = > this.responseText; > } > }; > xhttp.open("GET", "ajax_info.txt", true); > xhttp.send(); > } > </script> > > </body> > </html> > > The question is how do I get this code to run under web2py ? > > Thanks ... > > *Ben Duncan* > DBA / Chief Software Architect > Mississippi State Supreme Court > Electronic Filing Division > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/9b9fa219-3038-4d61-9206-a5ab134f783e%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.