My site has this about-page with a list of links to click with diffrent classes. These links obviously takes you to diffrent sub-content. Why do these links have diffrent classes? Because i use javascript and jquery, to grab some content out from a database and smack it in a div on the without reloading... The database has 3 fields: id, headline and content.
The javascript works fine. It does what it should do. it takes the links' class (which is the an ID in the database) and uses it to grab the right content..
Basically:
<?php
//take the post'ed variable you've been given.
if(isset($_POST['id']));
//for convenience use this variable insted
$id = $_POST['id'];
//connect to the database
mysql_connect("localhost","root","") or die('Could not connect: ' . mysql_error());
//select database
mysql_select_db("ropox");
mysql_query("SET NAMES utf8");
//Grab this data
$query = mysql_query("SELECT * FROM about WHERE id=$id");
while($row = mysql_fetch_array($query))
{
//echo it bask to the original page. This is printed on the original page
echo $row['content'];
}
?>
When you click the link, it takes 1,03 second before the content appears on the page. At first it was 2 seconds, but I've managed to cut it down. all of my other database connects happens almost instantly and they even echo lots of content through loops. Why is this so slow?