I was dropped on the head as a baby, so bear with me.
I know that there can be a 3rd argument for Jquery’s $post. I want to figure out what the best solution is, for a function, that can be used
so we can guarantee that no other jquery functions run until the $post action is completed.
I use $post to hit ‘vote.php’ to submit a vote but I want it to complete this process, and be able to confirm it (Without an annoying alert) so it can properly continue with the process of displaying vote results to the site visitor.
I just am not sure what I should do. What is the best idea, just create a function that displays a ‘please wait’ image that loads for a few seconds and then continue? I just need some help with this simple task so I can finally move on from a project. I just can’t wrap my brain around this simple task for some reason. Please note, my head is sore from all the drops so be kind
The idea is I created, for test purposes only, a function that alerts a message “Data Loaded” as the 3rd argument. Thing is, I realize an alert is useless.
I guess the goal is something like
function load_waiting_message()
{
// write load image
// cancel after 1 second, this function only loads after vote.php is successfully posted to
Actually, I don’t even need these bells and whistles. I just want somebody to confirm that if I create any function, even if just writes to a db or a log, the process.js/etc won’t load until the vote.php $post action is fully complete.
Will that happen if I just create ANY type of function and add it as the 3rd parameter? I just feel like I am in hell trying to wrap this up after so many hours of work on this monster. It’s killed my business and I just cannot find out a straight answer on google/etc.
Does anybody have any real world experience with something like this? I just want to know how to prevent process.js and the other include file from loading until the $post function is complete.
I did. The problem is that when I tried to create a function that does nothing other than an alert, it seemed to work fine. I am a php guy not quite getting the Async concept apparently.
I just figured that all I am doing is sending a vote (I am not producing json afterwards or doing anything…I just send a vote to a db and hope to god I can delay process.js and filter.js from loading until that vote exists)
Should I just create a function called ‘sent_data’ and have it log to another file/db and call that function as the 3rd argument? Would that allow all of those to ensure the vote is sent to vote.php before process.js loads?
Thanks. I know it sounds like a stupid q but it’s not native to me. I’d rather ask a stupid q and learn than continue to be a pickle head. Well, I guess I always will be one so that’s hopeless
PS. In short, I guess I assumed that if post is told to hit vote.php, and I do my php stuff, that’s all that matters. So what is the ideal way to tell my script “Ok, vote.php did it’s job, move on” without interfering (using alerts for the visitor to read)
with the vote process and pop up display (process.php)
Thanks
PPS. Yes, I am researching this but I figured I’d ask while I was here…ty, again.
The issue is that the concept is new. I just wanted to confirm that any type of success response will ensure the delay in those include files. If so I’ll work to create one. I just wanted to make sure I was grasping what I was reading, that’s all.
TY. I Think the jquery site has the best doc, the one you linked to. I just have to play with this and re-adjust the way I see things as I am used to the server side of things. It is sort of like going from the U.S to the U.K as a driver…just takes time.
I think way too much with this sort of thing. Have a good night and once I find a solution I will share it…