[web2py] Re: ajax polling with web2py [Closed]

2010-12-24 Thread weheh
Looks like this is going to have to be done with components. Didn't know until today that they even existed. Thank you chapter 13! On Dec 24, 3:53 pm, weheh wrote: > Argh. I'm struggling. The third arg to web2py_ajax_page is data. If > I'm ajaxing a multi-field form, can I make this > data=['fiel

[web2py] Re: ajax polling with web2py

2010-12-24 Thread weheh
Argh. I'm struggling. The third arg to web2py_ajax_page is data. If I'm ajaxing a multi-field form, can I make this data=['field1','field2',...]? I'm trying it but it doesn't seem to be working. On Dec 24, 1:36 pm, mdipierro wrote: > The general solution is web2py_ajax_page in my previous example

[web2py] Re: ajax polling with web2py

2010-12-24 Thread mdipierro
The general solution is web2py_ajax_page in my previous example and return js using response.js. On Dec 24, 11:22 am, weheh wrote: > Yes, I do have an ajax generated by code inside another ajax. But I'm > not married to that approach, especially if it doesn't work. I'm just > looking for anything

[web2py] Re: ajax polling with web2py

2010-12-24 Thread weheh
Yes, I do have an ajax generated by code inside another ajax. But I'm not married to that approach, especially if it doesn't work. I'm just looking for anything that works -- doesn't have to be pretty. Bottom line, we need a general solution to this problem. User clicks an ajax-ified widget/link/w

[web2py] Re: ajax polling with web2py

2010-12-23 Thread mdipierro
Do you have an ajax generated by code inside another ajax request? I believe SCRIPT(...) is returned but never executed for the same reason as in your code at the beginning of the thread: ... inside ajax content are ignored by the browser. On Dec 24, 12:16 am, weheh wrote: > Problem with my examp

[web2py] Re: ajax polling with web2py

2010-12-23 Thread weheh
Problem with my example above is that the setInterval is not being executed after the callback.

[web2py] Re: ajax polling with web2py

2010-12-23 Thread weheh
OK, I think I see what you're doing, but when I apply it to my ultimate app as opposed to the test case, it doesn't work. Here's an example that's practically identical to what I'm trying to do (some names have been changed): #view def poll(job_id): filename=db(db.mytable.job==job_id).select(db.

[web2py] Re: ajax polling with web2py

2010-12-23 Thread mdipierro
yes and no. First you missed a return false. Without that the page may get reloaded. #view DIV(A('click me',_href='#',_id='parent',_onclick("ajax('clickback', ['parent'],':eval');return false"))) #controller def clickback(): return 'jQuery("#parent").html("%s");' %\ SCRIPT("alert('hello wo

[web2py] Re: ajax polling with web2py

2010-12-23 Thread weheh
Massimo, I appreciate the response, but am finding your answer very difficult to understand. In particular, I don't have a clue as to what your callback is doing. What is response.js? Why are you returning "hello world" when response.js is outputting "hello!". Is there any chance you can rewrite th

[web2py] Re: ajax polling with web2py

2010-12-23 Thread mdipierro
It depends on how you do the ajax call: I suggest you can use the web2py_ajax.html function: web2py_ajax_page(method,action,data,target) For example in view click me and in controller def callback(): response.js = "jQuery('.flash').html('hello!').fadeIn();" return "hello world"

[web2py] Re: ajax polling with web2py

2010-12-23 Thread weheh
Hi Kuba - I believe it is the same or similar issue. I posted a similar issue a few months ago and never got a response. Anyway, this is mission critical for my app. I have a background queue that's generating data for display. While it's running, I have a javascript that should be polling the queu

Re: [web2py] Re: ajax polling with web2py

2010-12-23 Thread Kuba Kucharski
hi, that is a very good question. April, f.e: http://www.mail-archive.com/web2py@googlegroups.com/msg34855.html -- Kuba

[web2py] Re: ajax polling with web2py

2010-12-23 Thread weheh
Let me try to state this more succinctly: How do I get a jQuery, which is created by a controller in response to an ajax call, to execute when loaded into it's target div?

[web2py] Re: ajax polling with web2py

2010-12-23 Thread weheh
Sorry, I'm sure I wasn't clear. The routine I posted does not work. The parent div is properly updated, however the alert is not executed. I want the alert to be executed without further action by the user. On Dec 23, 7:02 pm, Michele Comitini wrote: > I do not know what criteria you would use t

[web2py] Re: ajax polling with web2py

2010-12-23 Thread weheh
Continued ... oops, I hit "send" ... of course, I want the alert to be triggered after writing "parent" div.