如何在将变量发送到Php时在Ajax调用期间清除chache变量 [英] How Do I clear chache Variable During The Ajax Call While Sending Variable To Php
问题描述
我无法在ajax调用期间停止上一个变量加载。
请找到onclick我传递变量并将值发送给ajax调用PHP脚本。
我有数据:
rnc.csv
DLRNC01
DLRNC02
DLRNC03
DLRNC04
DLRNC05
DLRNC06
DLRNC07
DLRNC08
DLRNC09
DLRNC10
DLRNC11
DLRNC12
DLRNC13
DLRNC14
代码
$ / b $ b $ / b
如果(($ handle = fopen(rnc.csv,r))!== FALSE){
$ i = 0;
$ values = array();
while(($ data = fgetcsv($ handle,1000,,))!== FALSE){
?>
)>
}
fclose($ handle);
}否则{
echo找不到文件;
}
?>
I am unable to stop the previous variable loading during the ajax call.
Please find onclick I am passing the variable and sending the value to ajax call to PHP script.
I having the data:
rnc.csv
DLRNC01
DLRNC02
DLRNC03
DLRNC04
DLRNC05
DLRNC06
DLRNC07
DLRNC08
DLRNC09
DLRNC10
DLRNC11
DLRNC12
DLRNC13
DLRNC14
code
if (($handle = fopen("rnc.csv", "r")) !== FALSE) {
$i=0;
$values=array();
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
?>
)" >
}
fclose($handle);
}else{
echo "File not found";
}
?>
< script>
//甚至我使用缓存清除了chache:false
//每次点击不同的变量传递给ajax调用而不是PHP脚本
函数pop(rnc)
{
$ .ajax({
url:'ajax1.php',
类型:POST,
cache:false,
// dataType:'json',
数据:{rnc:rnc},
成功:功能(数据){
$( #container1)。html(数据);
setInterval(function(){
console。 log(rnc);
$(#container1 )。html(数据);
},2000);
}
}); < br $>
}
< / script>
ajax1.php
当我将值传递给rnc_value.php后,在单击文件的值2到更多之后,ajax调用将回显之前每5秒钟调用的值。
当我在浏览器中执行console.log时:
ajax.php:344 DLRNC01
ajax.php:344 DLRNC05
ajax.php:344 DLRNC07
ajax.php:344 DLRNC04
ajax.php:344 DLRNC01
ajax.php:344 DLRNC02
2 ajax.php:344 DLRNC05
ajax.php:344 DLRNC06
ajax.php:344 DLRNC07
ajax.php:344 DLRNC04
ajax.php:344 DLRNC01
ajax.php:344 DLRNC02 < br $> b $ b
请帮帮我解决方案..
<script>
//even I cleared the chache using the cache:false
//for every click different variable is passing to the ajax call and than to PHP script
function pop(rnc)
{
$.ajax({
url: 'ajax1.php',
type: "POST",
cache: false,
//dataType:'json',
data:{rnc:rnc},
success: function(data){
$("#container1").html(data);
setInterval(function(){
console.log(rnc);
$("#container1").html(data);
},2000);
}
});
}
</script>
ajax1.php
when I am passing the value to the rnc_value.php, after clicking the values of the file two to more , than the ajax call is echoing what ever the values having previous called displaying for every 5 seconds.
When I do console.log in the browser :
ajax.php:344 DLRNC01
ajax.php:344 DLRNC05
ajax.php:344 DLRNC07
ajax.php:344 DLRNC04
ajax.php:344 DLRNC01
ajax.php:344 DLRNC02
2 ajax.php:344 DLRNC05
ajax.php:344 DLRNC06
ajax.php:344 DLRNC07
ajax.php:344 DLRNC04
ajax.php:344 DLRNC01
ajax.php:344 DLRNC02
Please help me what is the solution..
推荐答案
handle = fopen(rnc.csv,r))!== FALSE){
handle = fopen("rnc.csv", "r")) !== FALSE) {
i = 0;
i=0;
values = array();
while((
values=array();
while ((
这篇关于如何在将变量发送到Php时在Ajax调用期间清除chache变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!