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.

Reply via email to