我想清除或不写入缓存 url 图像,代码是在 ajax 上创建的。现在我想显示图像并且不保存在缓存中
索引.php
<html>
<head>
<meta charset="utf-8">
<LINK href="style.css" rel="stylesheet" type="text/css">
<script src="jquery.js"></script>
<script src="script.js"></script>
</head>
<body>
<form id="target" method="get" ENCTYPE="multipart/form-data">
Выберете файл:
<INPUT NAME="myfile" id="myfile" TYPE="file">
<br/>
Time:
<INPUT NAME="time" id="time" TYPE="text" value="10"><br/>
<INPUT TYPE="button" VALUE="Загрузить" onclick="show_info()">
</form>
<div id="result">
</div>
</body>
js
function getPath(path) {
var finalPath = path.substr(12);
return finalPath; // returns just file name and you can print/put in some input
}
function parse(){
var url = document.getElementById("myfile").value;
var time = document.getElementById("time").value;
url = getPath(url);
$.ajaxSetup({cache: false});
$.get('xml_parsing.php',{url:url,nextelement:k}, function(data) {
$('#result').html(data);
});
}
function show_info(){
setInterval("nextElement()", 5000);
}
function nextElement(){
k++;
parse();
}
和ajax文件
<?php
$doc = new DOMDocument();
$doc->load($_GET['url'] );
$products = $doc->getElementsByTagName( "offer" );
$id = $_GET['nextelement'];
$offers = $doc->getElementsByTagName( "offers" );
if($id<$products->length){
$price = $products->item($id)->getElementsByTagName( "price" );
$name = $products->item($id)->getElementsByTagName( "name" );
$currency = $products->item($id)->getElementsByTagName( "currencyId" );
$img = $products->item($id)->getElementsByTagName( "picture" );
$price_show = $price->item(0)->nodeValue;
$name_show = $name->item(0)->nodeValue;
$img_show = $img->item(0)->nodeValue."?anti_cache=" . rand(0,200);
$currency_show = $currency->item(0)->nodeValue;
echo "<div id='name'>".$name_show."</div>";
echo "<div id='image'><img src=".$img_show." ></div>";
echo "<div id='price'>".$price_show." ".$currency_show."</div>";
}
我怎样才能做到这一点?我有 3 个文件。一个 index.php,第二个 js 和 ajax 文件