No. In fact I never use the web2py ajax() function myself. It is there for
legacy reasons. I use jQuery.ajax() almost every time.
On Friday, 16 September 2016 00:49:04 UTC-5, Przemysław Loesch wrote:
>
> I'm wondering if using plain javascript XMLHttpRequest object instead of
> web2py ajax() can cause any problem or might be unsafe. The reason I've
> decided to do so is that I need to pass the server response (json object)
> to a js function as an argument.
> My js code looks like this:
> var query = document.getElementById('my-input-field').value;
> var xhttp = new XMLHttpRequest();
> xhttp.onreadystatechange = function() {
> if (this.readyState == 4 && this.status == 200) {
> var arg = JSON.parse(this.responseText);
> processArguments(arg);
> }
> };
> xhttp.open("POST", "/myaapp/controler/function/"+query, true);
> xhttp.send();
>
> Previously I used web2py ajax() function with :eval argument and short js
> code as the part of the response to be executed for calling js function.
> Then I've found XHTMLHttpRequest object works as well and is even easier to
> use when we want execute js code after server response. Now I'm just
> curious if it has ane disadvantage comparing to web2py ajax() or jQuery
> $.ajax().
> Thank you for your answer in advance.
> Przemek
>
>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.