应该这样做:
出现一个进度条,然后是thunbnails ..如果它正常工作。
有人可以直接向我解释一下我的标记错误吗? 我不明白这里可能是什么问题所以我在这里问,
我的网站:http://env-3884279.jelastic.servint.net/bot2/
如果0%没有出现,则说明工作不正确,
拒绝在除Firefox之外的任何其他浏览器中运行。为什么呢?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>capri</title>
<!-- Bootstrap -->
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body class="container" style="background-color: white; color: #333; font-family: 'Segoe UI';">
<br /><br />
<div>
<div id="status" class="pull-left"></div>
<div id="total" class="pull-right bg-success table-bordered" style="padding: 6px;">0 Movies Processed.</div>
<div class="clearfix"></div>
<br />
<div class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100">
</div>
</div>
<br />
<div class="clearfix"></div>
<div class="row-fluid" id="pagelist" style="border-top: solid whitesmoke 4px;">
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<script>
var processed = 0;
function ScanPage(pagenum, callback) {
$("#status").html("Please Wait... ");
$('.progress-bar').hide();
$('.progress-bar').css('width', 0 + '%').attr('aria-valuenow', 0).html(0 + '%');
$.ajax({
url: "movies/merdb/scanpage.php?token=" + Math.random() + "&p=" + pagenum,
cache: false,
async: true,
type: "GET"
}).done(function (html) {
var done = 0;
var json = JSON.parse(html);
var count = Object.keys(json).length;
$('.progress-bar').show();
$.each(json, function (iter) {
$.ajax({
url: "movies/merdb/parsepageresults.php?token=" + Math.random() + "&match=" + json[iter],
cache: false,
async: false,
type: "GET"
}).done(function (response) {
if (response != undefined && response != "") {
$("#status").html("<i class=\"fa fa-spinner fa-spin\"></i> Page <span class=\"badge\" style=\"background-color: whitesmoke; font-size: 16px;color: black;\">" + pagenum + "</span> Processing " + (done + 1) + " of " + count);
$("#pagelist").append("<div style=\"padding: 5px;\" class=\"col-xs-2\"><img src=" + response + " width=\"150\" height=\"225\"></div>");
var vpercent = parseInt(done * 100 / count);
$('.progress-bar').css('width', vpercent + '%').attr('aria-valuenow', vpercent).html(vpercent + '%');
}
done++;
processed++;
$("#total").html(processed + " Movies Processed.");
});
});
$("#status").html("Scanning Page " + pagenum + " has completed. <span class=\"glyphicon glyphicon-ok\" style=\"color: green\"> </span>");
callback(pagenum + 1);
});
}
function Begin(index) {
ScanPage(index, OnCompleted);
}
function OnCompleted(index)
{
$("#pagelist").html("");
Begin(index);
}
Begin(1);
</script>
</body>
</html>
答案 0 :(得分:0)
尝试将您拥有的所有脚本<script src="https://aja....
置于最顶层。
答案 1 :(得分:0)
删除
$('.progress-bar').hide();
如果你想看到0%
此外,返回的base64不正确,Chrome正在尝试从网址
下载 你正在&#34;数据:JPG; BASE64,......&#34;
什么时候你应该
&#34;数据:图像/ JPG; BASE64,....&#34;
答案 2 :(得分:0)
您的Ajax缩小的Java脚本没有正确响应。尝试将缩小的java脚本放在HTML的head部分中。尝试下载并保存缩小的代码并通过您的机器运行,这样过程就会快一些。