sKunKbad Posted November 21, 2007 Share Posted November 21, 2007 If I send an AJAX request to a php script as a page loads, and the user exits the page before the php script is done processing what it is doing, it should still do what it needs to do right? I've got a cURL script that adds users to a email database, but it runs slow (2 seconds) and I want to do it without the user seeing the lag. My plan would be to have the user see the "thank you" message while the cURL script is running in the background. I'm just concerned that if they see the thank you message and exit the page that the AJAX request would be interrupted. Quote Link to comment https://forums.phpfreaks.com/topic/78265-solved-onloading-some-ajax/ Share on other sites More sharing options...
sKunKbad Posted November 22, 2007 Author Share Posted November 22, 2007 It works fine in case anybody ever wants to know. I used a javascript detection in previous pages to make sure that PHP knows to either use the ajax type HTTPrequest or cURL script directly. As a side note, I couldn't find any javascript detection tutorials out there. What I ended up doing is setting a cookie with javascript, and then checking to see if it exists in php. If php sees the cookie set by javascript, it turns it into a session variable. When the user finally gets to the page that needs to know if javascript is enabled or not, php dishes out the correct code for the situation. Quote Link to comment https://forums.phpfreaks.com/topic/78265-solved-onloading-some-ajax/#findComment-396861 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.