On Tuesday, June 4, 2019 at 3:16:12 PM UTC-7, Ben Duncan wrote:
>
> I've been trying to run it ... When you click on the button it does nothing
>
> *Ben Duncan*
> DBA / Chief Software Architect 
> Mississippi State Supreme Court
> Electronic Filing Division
>
>
>

When I replace the "ajax-info.txt" with a real URL (that is, one for a 
web2py function on my server, and which returns a txt file), I see the 
network access, including a response with HTTP status 303.  For some reason 
(cookie management?) it doesn't work for me to login via a separate tab, 
and each time I click the button I get a different cookie.  I've been 
poking at sending credentials, but I still get the 303 response and I 
apparently am not setting the Authorization header as I think I am, but 
only setting Access-Control-Request-Headers to "authorization".  And there 
is also "allow origin" issues, because file://tmp/test.html comes from a 
different address than the server.

HTH
/dps


On Tue, Jun 4, 2019 at 4:35 PM Anthony <abas...@gmail.com <javascript:>> 
> wrote:
>
>> 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 web...@googlegroups.com <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/web2py/9b9fa219-3038-4d61-9206-a5ab134f783e%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/web2py/9b9fa219-3038-4d61-9206-a5ab134f783e%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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/e58217b0-df00-4897-aa57-40a92b019ada%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to