good morning,
i have livestamp.js on website , external .php file parses date string vatsim data file.
the code 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 code pulling date string external file 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 html has this: <span data-livestamp="1454063536"></span>
how can change ajax code either replace example date string data string php file or insert contents of php file in between quotation marks in <span data-livestamp="1454063536"></span>
line?
thanks in advance.
simply can !
success: function(reply) { $("[data-livestamp]").data('livestamp', reply) }
Comments
Post a Comment