setTimout and dialog.close with jquery after return message
I have an email submission modal and everything works fine. It grabs the data, PHP processes the data and sends an email and then gives the success message back to the script then the script display "thank you for submitting. blah blah blah."
After that I'm trying to use setTimeout to close that final message but it isn't working.
Here's the code that finishes the email submission:
- if (data.responseText !== ' ') {
- $(#emailModal).text(data.responseText);
- setTimeout(function(){ $('#emailModal').dialog('close')}, 5000);
- }
- else {
- $(#emailModal).text('Bad back end! Please try to send your message later.');
- }
Thank you for any help!