Re: [web2py] Re: the ajax callback action return a list [URGENT]

2017-06-01 Thread Paco Bernal
In server side when rendering the view you use python vars with {{=my_python_var}} If you are asking how to use a python var in client side with javascript you can use ASSIGNJS(js_var=python_var) Take a look at the files I uploaded before. def mycontroller(): . return ASSIGNJS(js_v

Re: [web2py] Re: the ajax callback action return a list [URGENT]

2017-06-01 Thread sunda . amran
I totally agree with that but then how do you use that list in the view as a python variable ??? Le jeudi 1 juin 2017 09:09:15 UTC+2, Junior Phanter a écrit : > > > var list_sunda = ""; > ajax("your_echo_url", [], ':eval'); > > > def echo_url(): > list_sunda=[1,2,3,4,5] > return "list_

[web2py] Re: the ajax callback action return a list [URGENT]

2017-06-01 Thread Paco Bernal
But what are you returning in the controller?? El jueves, 1 de junio de 2017, 8:49:46 (UTC+2), sunda...@gmail.com escribió: > > Hey paco, > > the problem is that i am using script, so the the action in the controller > is a callback, it means that it dont have his html page. > > -- Resourc

Re: [web2py] Re: the ajax callback action return a list [URGENT]

2017-06-01 Thread Junior Phanter
var list_sunda = ""; ajax("your_echo_url", [], ':eval'); def echo_url(): list_sunda=[1,2,3,4,5] return "list_sunda=%s;" %list_sunda 2017-06-01 3:49 GMT-03:00 : > Hey paco, > > the problem is that i am using script, so the the action in the controller > is a callback, it means that it d

[web2py] Re: the ajax callback action return a list [URGENT]

2017-05-31 Thread sunda . amran
Hey paco, the problem is that i am using script, so the the action in the controller is a callback, it means that it dont have his html page. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/we

[web2py] Re: the ajax callback action return a list [URGENT]

2017-05-30 Thread Paco Bernal
Here you have an example about what I told you without using ':eval' It's easier to user alert('{{=client_details.name}}'); of course, it's only to show you ASSIGNJS and that you always can do things in many several ways :) El martes, 30 de mayo de 2017, 14:46:08 (UTC+2), sunda...@gmail.com

[web2py] Re: the ajax callback action return a list [URGENT]

2017-05-30 Thread Paco Bernal
mmm... maybe you are looking for ASSIGNJS(js_var=python_list) It depends on the way you want to do whatever you wanna do :) if you get the name of the list is because you *return dict(your_list=your_list)* and in the view you have* {{=your_list}} *you need to *return ASSIGNJS(my_js_var=you

[web2py] Re: the ajax callback action return a list [URGENT]

2017-05-30 Thread sunda . amran
In my controller, i have a list which i called tools which containes values. I would like to return this list like you said. In my view i would like to retrieve the value and to put the values inside variable( with loop i think) But when i put eval and i call the function javascription from th

[web2py] Re: the ajax callback action return a list [URGENT]

2017-05-26 Thread Paco Bernal
Or you can use ':eval' as the third argument as Anthony says and return '%s%s' % (ASIGNJS(your_js_var=your_python_list), 'your_js_code_for_manipulating_the_list') This way you can manipulate your list with js in client side, but I prefer using a view if the html code is more than one or two li

[web2py] Re: the ajax callback action return a list [URGENT]

2017-05-26 Thread Paco Bernal
You have to use a view to work with the list returned by the function. Both, the view and the funcion with the same name or using response.view="view_name.html" El miércoles, 24 de mayo de 2017, 10:23:05 (UTC+2), sunda...@gmail.com escribió: > > Hello, > > > i have a form, when i fill it, it

[web2py] Re: the ajax callback action return a list [URGENT]

2017-05-24 Thread Anthony
If you are using the ajax() function, note the third argument can be: - ":eval", in which case, you can return Javascript code to be executed (this code could, for instance, define a Javascript array). - A Javascript function, in which case, the returned data will be passed to that f

[web2py] Re: the ajax callback action return a list [URGENT]

2017-05-24 Thread Leonel Câmara
This is more of a javascript question than a web2py one. If you don't want to display the list in HTML just don't do it, just get the list using $.getJSON or something and do whatever you want to do with it in javascript. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation