Firstly , Your php, should look like this,
header('Access-Control-Allow-Origin: *');
$host="your host i.e 0.0.0.0"; // Host name
$username="your username"; // Mysql username
$password="your password"; // Mysql password
$db_name="the database name"; // Database name
$tbl_name="your table name"; // Table name
// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
// Retrieve data from database
$sql="SELECT * FROM your table name ORDER BY id DESC LIMIT 300";
$result=mysql_query($sql);
// Start looping rows in mysql database.
while($rows=mysql_fetch_array($result)){
echo $rows['id'] . "|";
}
// close MySQL connection
mysql_close();
?>
Then you should be able to access the ajax.lastdata, make sure it shows up in the debugger.