AJAX用外部日期字符串替换Span String

Good morning,

I have Livestamp.js on my website and an external .php file that parses a date string from the VATSIM data file.

The code for the PHP file is:

<?php
require_once './vendor/autoload.php';

$logFile = './vendor/skymeyer/vatsimphp/app/logsusers.log';

$vatsim = new \Vatsimphp\VatsimData();
$vatsim->setConfig('cacheOnly', true);
$vatsim->setConfig('logFile', $logFile);

if ($vatsim->loadData()) {
    $info = $vatsim->getGeneralInfo()->toArray();
echo "{$info['update']}";
} else {
echo "Cannot load data";
 }

?>

This is my code for pulling the date string from the external file into my website:

<script type="text/javascript">
function get_update() {
    $.ajax({
        type: 'POST',
        url: 'update.php',
        data: {
            request: 'true'
        },
        success: function(reply) {
            $('.data-livestamp').html("" + reply + "");
        }
    });
}
$(document).ready(function() {
    get_update();
});
</script>

The Livestamp.js code for the HTML has to look something like this: <span data-livestamp="1454063536"></span>

How can I change the AJAX code to either replace the example date string with the data string from my PHP file or to insert the contents of the PHP file in between the quotation marks in the <span data-livestamp="1454063536"></span> line?

Thanks very much in advance.

I worked the answer out:

<script type="text/javascript">
   function get_update() {
      $.ajax({
        type: 'POST',
        url: 'update.php',
        data: {
            request: 'true'
        },
        success: function() {
            $('#update').livestamp(new Date());
        }
    });
  }
  $(document).ready(function() {
    get_update();
  });
</script>

Try this:

success: function(reply) {
            $("[data-livestamp]").attr('data-livestamp', reply)
        }

simply you can do this !

    success: function(reply) {
        $("[data-livestamp]").data('livestamp', reply)
    }