That was a long thread which I didn't read fully. But what I did read made
me think that maybe the original problem was that you needed a slight delay
between when you showed the span and when you made the ajax call. I do that
by putting the ajax call in a setTimeout function. If I don't, the screen
doesn't update until the ajax call is completed.

On Tue, 3 Nov 2020, 7:36 pm mostwanted, <godirao...@gmail.com> wrote:

> I have a hidden span that i want displayed when a link is clisked while
> waiting for the page to load but this is not working! I dont know where I
> am going wrong but thought I had it right, please assist me.
>
> *CSS:*
> .link_loader
> {
>     display: none;
> }
>
> *CONTROLLER*
> *#The yellow line is the hidden span that has the loader I want to display*
> def ajaxlivesearch():
>     keywords = request.vars.keywords
>     print "Keywords: " + str(keywords)
>
>     if keywords:
>         query = reduce(lambda
> a,b:a&b,[db.services.service_name.contains(k) for k in keywords.split()])
>     services = db(query).select()
>     items = []
>
> if services:
>         for c in services:
>             items.append(DIV*(SPAN("loading ...", SPAN(_class="fa
> fa-spinner fa-spin"), _class="link_loader",
> data={'id':"res%s"%c.service_name})*, A(c.service_name, _class="service",
> _style="font-weight: bold;", _href=URL('companies', args=c.id),
> _id="res%s"%c.service_name,
> _onclick="updatelivesearch(jQuery('#res%s').html())" % c.service_name)))
>
> *VIEW*
> *#This jQuery script attempts to display the hidden span*
>
> *<script>*$(document).ready(function(){
>             $('.service').click(function(e) {
>         const id = $(this).data('id');
>         $('#' + id).fadeIn();
>         e.preventDefault();
>
>             });
>             });
>
> *</script>*
>
> Regards;
>
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/3b8a175c-ecdc-47e5-a157-45e7fe260f9fn%40googlegroups.com
> <https://groups.google.com/d/msgid/web2py/3b8a175c-ecdc-47e5-a157-45e7fe260f9fn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMMxq2KBKA-5JocJFjmNtMkB3uNP7kY_wqGAXnA06P5C4g%40mail.gmail.com.

Reply via email to