1

I'm calling a php page using a jquery command, this php page will make some sql queries after that it update a cookie value...I want to get this value but only after all the php page has done the full job...I'm using this code right now to call the php page:

$(".emptyBox").load("gettingTime.php");
var setTime = readCookie("timeNow");

The problem in this code is that he load the php page but he does not wait untill in finish it work so the setTime variable it gets the value of the previous php page call...I want it to wait untill the php page finish successfully then it reads the cookie.

1

1 Answer 1

1

Use the complete callback of load()

var setTime

$(".emptyBox").load("gettingTime.php", function(){
   // new html has been loaded here
   setTime = readCookie("timeNow");
});
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you for your answer, I have to ckeck it deeper...As I understand load it mean that the code has started successfully and it may not mean that all the commands inside it were completed successfully. If I'm wrong, please explain to me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.