外部PHP以HTML格式发布数据

I have a website Im making. I have made a php file that pulls data from a database and displays it in HTML (the php and html are all within a php file). How do I make it so that I can call the external php file and load the data into a HTML document and also make it work with CSS allocated to that HTML doc?

ive tried this:

<script src="/some_local_link/data.php"</script>

and:

<?php include="/some_local_link/data.php"; ?>

but it doesnt work. Nothing is loaded. Can I remove the HTML from inside the PHP or how do I format it? It has and tags and everything but those are already in the main HTML file.

I was having trouble including files as well. Here is what I found.

Includes in PHP can only pull files from the current directory

<?php include('data.php'); ?>

Or directories up the "ladder"

One level

<?php include('../data.php'); ?>

Two levels

<?php include('../../data.php'); ?>

To my knowledge it's not possible to jump around directories for includes in php

You should use AJAX to load the data into the HTML.

        $.ajax({
            url: '/some_local_link/data.php',
            type: 'GET',
            dataType: 'html',
            success: function(data){
                 $( "body" ).append(data)
            }
        });