All need is that ul list is populated with data from php code,on page load.Thanks in advance,and sorry if I am not exact,I am new here.This post is mostly code.

**Here's the code of ajax function:**

```
$(document).ready(function() {
            var podtip="proba";
            $.ajax({
                url: 'php/dodajTVpocetna.php',
                type: 'POST',
                cache:false,
                data: { target: podtip },
                success: function (data) {

                        $('#slider ul').append(data);
                    }

            }); 

        }); 

```

**Here's the code of php file:**

```
$q = $_POST['target'];
    $conn=mysqli_connect("localhost","root","","iptv");
                        if (mysqli_errno($conn)) {
                            die("Neuspjela konekcija: " . mysqli_connect_error());

                    }
                else{
                    $upitM='SELECT * FROM stream WHERE Kategorija="Music" ORDER BY rand() LIMIT 0,1';
                    $music=mysqli_query($conn,$upitM);

                    $upitF='SELECT * FROM stream WHERE Kategorija="Movies" ORDER BY rand() LIMIT 0,1';
                    $film=mysqli_query($conn,$upitF);

                    $upitS='SELECT * FROM stream WHERE Kategorija="Series" ORDER BY rand() LIMIT 0,1';
                    $series=mysqli_query($conn,$upitS);

                    $upitN='SELECT * FROM stream WHERE Kategorija="News" ORDER BY rand() LIMIT 0,1';
                    $news=mysqli_query($conn,$upitN);

                    $upitMO='SELECT * FROM stream WHERE Kategorija="More" ORDER BY rand() LIMIT 0,1';
                    $more=mysqli_query($conn,$upitMO);

                    if(!$music)echo'greska je "'.mysqli_error($conn).'"';

                    while(($row = mysqli_fetch_assoc($music)) != NULL) {
                            $row1 = mysqli_fetch_assoc($news);
                            $row2 = mysqli_fetch_assoc($film);
                            $row3 = mysqli_fetch_assoc($series);
                            $row4 = mysqli_fetch_assoc($more);
                            print_r(error_get_last());
                            echo"<li><div class=\"tv\"><a href='javascript:changeVideoJW(\"".$row['Link']."\");'>".$row['Naziv']."</a></div></li>
                                <li><div class=\"tv\"><a href='javascript:changeVideoJW(\"".$row1['Link']."\");'>".$row1['Naziv']."</a></div></li>
                                <li><div class=\"tv\"><a href='javascript:changeVideoJW(\"".$row2['Link']."\");'>".$row2['Naziv']."</a></div></li>
                                <li><div class=\"tv\"><a href='javascript:changeVideoJW(\"".$row3['Link']."\");'>".$row3['Naziv']."</a></div></li>
                                <li><div class=\"tv\"><a href='javascript:changeVideoJW(\"".$row4['Link']."\");'>".$row4['Naziv']."</a></div></li>";
                            }

            mysqli_close($conn);
                }

```

**HTML list:**

```
<div class="w3-third">
  <div id="liquid1" class="liquid">
    <span class="previous"></span>
    <div class="wrapper">
        <ul id="slider">

        </ul>
    </div>
   <span class="next"></span>
</div>
</div>

```

I used ajax before,and it worked this way.