I am trying to make ajax jsonrpc call to my web service using jQuery as 
given below: 

   $(document).ready(function() {
    $("#btnNext,#btnPrevious").click(function() {
        var req = {
            jsonrpc: "2.0",
            method: "nextprevexample",
            id: (new Date).getTime()
        };
        req.res = {
            name: 'aajas'
        };
        $.ajax({
            url: "http://127.0.0.1:8000/adv01/default/call/jsonrpc";,
            data: JSON.stringify(req),
            dataType: "json",
            type: "POST",
            contentType: "application/json",
            success: function(rpcRes) {
                alert(rpcRes.result);
                $("#lblexample").text(rpcRes.result[1]);
                $("#txtexamplereviewed").val(rpcRes.result[1]);
            },
            error: function(err, status, thrown) {
                alert(thrown); //alert(status);alert(thrown);
            }
        });
        return false;
    });});

I am trying to access it in my web2py web service. The code of web service 
is as follows:

@service.json   @service.jsonrpc    def nextprevexample():    
    print request.post_vars
    exampleid,exampletext=getcorrespondingexample()
    return exampleid,exampletext

But the problem is I don't get anything in post_vars. 

I tried to search entire request object to find any property which would 
give me posted data but didn't find one.

Please let me know if I have doing anything wrong over here.

-- 
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