I want to run bellow php page when a user logs in. I'm using bellow php code to show online visits with their name and I also linked their profile page with it. 

The php page is running when the `online.php` is reloading. 

It's the normal way of php, I know, but I want to use ajax to run bellow php script. I know how to send form data using ajax, but I don't know how to send data if there aren't any forms inside the page. 

How is this possible? I tried it but it's not working yet. **Note**: I'm also using JQuery. 

**AJAX code**

```
//update the online users list
$.ajax({
    type: "POST",
    url: "online.php",
    data: data,
    success: function (response) {
        $("#online").html(response);
    }
}); //end it

```

**PHP code**

```
<?php
    session_start();

    include('controller/class/RO_dbconfig.php');

    $sth = $dbconnect->prepare("SELECT first_name,keyId FROM register WHERE status = :online");
    $params = array("online" => 1);
    $sth->execute($params);
    $status = $sth->fetchAll();

    echo "<div id='online'>";

    foreach($status as $onlineArray) {
        echo "<ul class='online'>";
        echo "<li><a href='timeline.php?profileId=".$onlineArray['keyId']."'>".$onlineArray['first_name']."</a></li>";
        echo "</ul>";
    }

    echo "</div>";
?>

```