I am trying to do something that is supposed to be relatively simple, i 
want to submit a value through a form to a controller for calculations 
using ajax so that the page doesn't refresh but i am not getting any 
results back in my view, i changed the way of doing that using ajax just 
a-little bit, here is an example below: Its not working, I just wanna 
submit a value from a view to a function without the view refreshing!

*VIEW:*
{{extend 'layout.html'}}

<div>The answer: {{=answer}}</div>

<form id="myform">
<input name="name"/> <input type="submit" />
</form>

<script>
$('document').ready(function(){
$('#myform').submit(function() {
ajax("{{=URL('index')}}",['name'], ':eval');
return false;
});
});
</script>

*CONTROLLER:*
def index():
    answer=0
    info=request.vars.name
    if info is None:
        info=0
    if info:
        info=int(info)
        num1=200
        answer=info-num1
    return locals()

Help!!!

Mostwanted

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