是否可以让ajax运行直到它会读取某些内容,例如<!--end-->
,我该怎么做?
我想调用一个页面,当它到达时停止阅读页面 - 我只需要阅读HEAD的内容
答案 0 :(得分:0)
假设你没有反对php的话,那就有意义了。
不是调用你的文件,而是调用一个php脚本,它将解析你的文件,直到你的标记为<!--end-->
。我们将其命名为parser.php
。
<?php
//Retrieve your file. It can be any type of plain text file which doesn't need
//to be interpreted, even html.
$lines = file("yourfile.txt");
$i = 0;
while(trim($lines[$i])!=="<!--end-->"){
echo $lines[$i];
}
?>