Re: [web2py] Asynchronous submission of request.vars values to Controller for calculations using Ajax

2019-04-17 Thread António Ramos
post a screenshot of your error and code...

Em qua, 17 de abr de 2019 às 17:51, mostwanted 
escreveu:

>  I have seriously fiddled with docs code trying to bend it to my will but
> its not obliging, maybe its my limited programming skills but thanks for
> replying Ramos.
>
> 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.
>

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


Re: [web2py] Asynchronous submission of request.vars values to Controller for calculations using Ajax

2019-04-17 Thread mostwanted
 I have seriously fiddled with docs code trying to bend it to my will but 
its not obliging, maybe its my limited programming skills but thanks for 
replying Ramos.

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.


Re: [web2py] Asynchronous submission of request.vars values to Controller for calculations using Ajax

2019-04-17 Thread António Ramos
try this from the docs... then change it accordingly to your needs

def one():
return dict()
def echo():
return request.vars.name

and the associated "default/one.html" view:

{{extend 'layout.html'}}
   


Em qua, 17 de abr de 2019 às 13:47, mostwanted 
escreveu:

> I understand what u are saying, how can i achieve what i am trying to
> achieve this? Submit values to a controller without refreshing a page?
>
> On Wednesday, April 17, 2019 at 1:58:56 PM UTC+2, Ramos wrote:
>>
>>
>>
>> http://www.web2py.com/books/default/chapter/29/11/jquery-and-ajax#The-ajax-function
>>
>>
>>
>> Note the diference between :eval and the 'target' id alternative
>> If you use eval than you have to return not locals() but a string with
>> javascript to be evaluated like for example jQuery('#target').html('100'
>> );
>>
>> from the docs...
>>
>> {{extend 'layout.html'}}
>>
>>
>>
>> {{extend 'layout.html'}}
>>
>>
>>
>>
>>
>> Em qua, 17 de abr de 2019 às 12:18, mostwanted 
>> escreveu:
>>
>>> 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'}}
>>>
>>> The answer: {{=answer}}
>>>
>>> 
>>>  
>>> 
>>>
>>> 
>>> $('document').ready(function(){
>>> $('#myform').submit(function() {
>>> ajax("{{=URL('index')}}",['name'], ':eval');
>>> return false;
>>> });
>>> });
>>> 
>>>
>>> *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 web...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> 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.
>

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


Re: [web2py] Asynchronous submission of request.vars values to Controller for calculations using Ajax

2019-04-17 Thread mostwanted
I understand what u are saying, how can i achieve what i am trying to 
achieve this? Submit values to a controller without refreshing a page?

On Wednesday, April 17, 2019 at 1:58:56 PM UTC+2, Ramos wrote:
>
>
>
> http://www.web2py.com/books/default/chapter/29/11/jquery-and-ajax#The-ajax-function
>   
>
>  
> Note the diference between :eval and the 'target' id alternative
> If you use eval than you have to return not locals() but a string with 
> javascript to be evaluated like for example jQuery('#target').html('100');
>
> from the docs...
>
> {{extend 'layout.html'}}
>
>
>
> {{extend 'layout.html'}}
>
>
>
>
>
> Em qua, 17 de abr de 2019 às 12:18, mostwanted  > escreveu:
>
>> 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'}}
>>
>> The answer: {{=answer}}
>>
>> 
>>  
>> 
>>
>> 
>> $('document').ready(function(){
>> $('#myform').submit(function() {
>> ajax("{{=URL('index')}}",['name'], ':eval');
>> return false;
>> });
>> });
>> 
>>
>> *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 web...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

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


Re: [web2py] Asynchronous submission of request.vars values to Controller for calculations using Ajax

2019-04-17 Thread António Ramos
http://www.web2py.com/books/default/chapter/29/11/jquery-and-ajax#The-ajax-function



Note the diference between :eval and the 'target' id alternative
If you use eval than you have to return not locals() but a string with
javascript to be evaluated like for example jQuery('#target').html('100');

from the docs...

{{extend 'layout.html'}}
   


{{extend 'layout.html'}}
   




Em qua, 17 de abr de 2019 às 12:18, mostwanted 
escreveu:

> 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'}}
>
> The answer: {{=answer}}
>
> 
>  
> 
>
> 
> $('document').ready(function(){
> $('#myform').submit(function() {
> ajax("{{=URL('index')}}",['name'], ':eval');
> return false;
> });
> });
> 
>
> *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.
>

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


[web2py] Asynchronous submission of request.vars values to Controller for calculations using Ajax

2019-04-17 Thread mostwanted
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'}}

The answer: {{=answer}}


 



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


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