Jump to content

[SOLVED] onLoading some AJAX


sKunKbad

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.