Jump to content

[SOLVED] AJAX mysql request


XpertWorlock

Recommended Posts

This is just an example, a list that when you click a "Name" it retrieves server information "Age, Location, etc."

 

If a PHP file makes the SQL request, does the page make a SQL request everytime a new name is clicked, or is the page cached? or can it be cached?

 

I'm not asking for code or any help, I'd just like to get a better understanding on how AJAX works.

Link to comment
Share on other sites

It's possible for the page to be cached, based on your server settings, or the browser settings.

 

Ajax makes a new HTTP request each time.  It's just the same as if you were loading the page itself, only it does it in the background without you seeing it.

 

What you could do is build a javascript array based on the names unique ID and have the page check to see if the extra data exists in javascript already (been clicked once) before asking the page to do an sql query.  (Then take the query and store the info in the javascript so that it is now cached.)  You can also use sessions to store that data.

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.