Skip to main content
WolfShade
Legend
June 23, 2016
Question

jQuery, promise(), and done() - is it really?

  • June 23, 2016
  • 1 reply
  • 823 views

Hello, all,

I have kind of a weird jQuery issue going on, and I'm not sure what to make of it.

The project that I'm working on (unfortunately, it's on a restricted site, so no one can access it) is a blog that allows comments and replies.

From the main page, if a blog has any comments, there is a link at the bottom of the blog that allows the user to view the comment.  Clicking the link will expand a hidden div that contains the comment.

If there is a reply to the comment, there is a text link ("More") that appears.  Clicking the "More" link will use AJaX to run a query on the database to get the reply.

I have it set up so that when the link is clicked, a small spinner gif will appear to let the user know that the system is working in the background to get the reply.  Once the database returns the data, the spinner disappears and is replaced by the content.

Here's the issue:  I'm using promise().done(function(){}); to make that happen, which is supposed to wait until the data is loaded before making the spinner disappear.  But the spinner is disappearing almost immediately, and the reply content is not appearing for at least 10 to 15 seconds.

It's as if the server is giving an immediate response of "Got it!  Here ya go," but the browser is taking its sweet time displaying the content.

Any suggestions on either A) what's causing this, or B) how to get it to wait until the browser is ready to display the content before making the spinner disappear?

V/r,

^_^

    This topic has been closed for replies.

    1 reply

    Inspiring
    June 23, 2016

    Its a bit hard to say without more code. You will really need to provide the whole block that does the job.

    I would say you will be better off asking this questions on Stack Overflow.​ You will get a response pretty quick there for jQuery related issues, this is a Adobe Coldfusion forum after all.

    WolfShade
    WolfShadeAuthor
    Legend
    June 23, 2016

    StackOverflow (and all related sites) are not so much a support forum as they are a popularity contest.  Questions are voted down just for the sake of voting down, without any real explanation as to why.  I had an SO account, once.  I deleted it four days later, after having stared in slack-jawed amazement at the stupid 5h|t people do, there.

    I do realize that this is a CF forum; a lot of CF coders also work with JavaScript and either jQuery or MooTools.  And since this question involves using AJaX to run a .cfc function that queries a database and returns data, my question is not un-related.

    V/r,

    ^_^

    PS:  Let me get the code organized so I can provide some pseudocode samples of what I am doing.

    Carl Von Stetten
    Legend
    June 23, 2016

    That would be a huge "no" from work.  Blocking the proxy, so I cannot access it from work.  Dangit. 

    V/r,

    ^_^


    I sent up a flare on Slack for you.  We'll see if someone responds back here.

    -Carl V.