I have an application which communicates with mobile phone gate. User has to send SMS/Text to number and then needs to wait for confirmation.
I’d like to know how to check for response until user receives it. How can I call AJAX check every 10 seconds?
You can use a spin-off of a long polling technique.
Basically just set a setInterval function that will fire every 10 seconds. The callback function of that will be your ajax call. Make the ajax function check the value of a variable, presumably one that is a boolean representing whether or not the text has been confirmed.
The reason why I have the !condition part is because I dont want the function to execute all the way if the condition has already come back true, thus confirming the text.
You should then kill the interval function too.