Javascript + PHP,总是下载相同的

时间:2015-10-28 16:07:51

标签: javascript php jquery mysql ajax

我从网站上下载文件时遇到问题。

当我加载我的页面时,我无法下载该文件及其正确的文件。 (http://example.com/file.php?id=111)但是当我刷新youtube embed时,它显示我的下一个视频(使用mysql),当我再次点击下载按钮时,它仍然会下载以前的文件。而不是下一个文件。

Code Snipets:

BLANK.PHP (是我的播放器所在的页面)

<script>
function ajax_request(){
    $("#video_frame").load("<?php echo $actual_link; ?>");
}
</script>
<?php $actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; ?>   
<div id="video_frame" class="video">
    <?php include('video.php'); ?>
</div>

VIDEO.PHP

<script>
$('#download_ajax').click(function(e) {
    e.preventDefault();  //stop the browser from following
     window.open('http://example.com/fetch/?videofile=http://www.example.com/watch?v=<?php echo $urlid; ?>','_blank');
});
</script>
<?php
//MYSQL CONNECTION
    if($_GET['p'] == 'house') {
        $hitsq = $mysqli->query("SELECT urlid FROM `***` ORDER BY RAND() LIMIT 1");
        $hits = $hitsq->fetch_assoc();
        $urlid = $hits['urlid'];
    } else if ($_GET['p'] == 'drumandbass') {
        $hitsq = $mysqli->query("SELECT urlid FROM `***` ORDER BY RAND() LIMIT 0,6");
        $hits = $hitsq->fetch_assoc();
        $urlid = $hits['urlid'];
    } else if ($_GET['p'] == 'hiphop') {
        $hitsq = $mysqli->query("SELECT urlid FROM `***` ORDER BY RAND() LIMIT 0,6");
        $hits = $hitsq->fetch_assoc();
        $urlid = $hits['urlid'];
    } else if ($_GET['p'] == 'futurehouse') {
        $hitsq = $mysqli->query("SELECT urlid FROM `****` ORDER BY RAND() LIMIT 0,6");
        $hits = $hitsq->fetch_assoc();
        $urlid = $hits['urlid'];
    } else if ($_GET['p'] == 'rock') {
        $hitsq = $mysqli->query("SELECT urlid FROM `****` ORDER BY RAND() LIMIT 0,6");
        $hits = $hitsq->fetch_assoc();
        $urlid = $hits['urlid'];
    }
?>    
<div class="video">
    <iframe name="Right" frameborder="0" height="100%" width="100%" src="https://example.com/embed/<?php echo $urlid ?>?rel=0&autoplay=1&controls=0&showinfo=0&autohide=1">
</iframe>
</div>

Site Snippet Preview

0 个答案:

没有答案