Sorry, but they are not stored in request.vars as expected. It works fine 
in the alert window, but I can't retrieve the values in the controller to 
handle them. I have tried with a diferent function in the controler, like 
this:

def test2():
    result=testpost()
    return locals()
    
def testpost():
    datos=str(request.vars)
    key=request.vars.key
    return locals()


The view:

{{extend 'layout.html'}}
<h2>Template default/test2.html</h2>

{{=BEAUTIFY(response._vars)}}

<script>
  $(document).ready(function(){
  $.ajax({
    type: 'POST',
    url:'{{=URL('default','testpost.json',args='datos')}}',
    data: {'key':'value','key2':'value2'},
    dataType: 'json',
      success:  function(data){  alert("Data:"+ data.datos); }
});
  });
</script>


And the result: 

<https://lh5.googleusercontent.com/-PIXsDgJWotI/VJFcBhXJLTI/AAAAAAAAArI/YBS5zRL7dvA/s1600/Selecci%C3%B3n_808.png>

Maybe I have to declare key and key2 as var in the script? Because the 
values I get in the request.vars are <Storage{}> instead 
of {'key':'value','key2':'value2'} as desired. So they are not stored in 
request.vars


El martes, 16 de diciembre de 2014 19:57:30 UTC+1, Leonel Câmara escribió:
>
> It should, but it should also be in request.vars which is the standard 
> place to deal with it, you should have request.vars.key and 
> request.vars.key2.
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to