我的代码在localhost上运行良好,但是在服务器上出现403错误。
我试图将XMLHttpRequerst更改为XMLHttpsRequerst,但是这样的功能不存在...
function liGenerator() {
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == XMLHttpRequest.DONE) {
if (xmlhttp.status == 200) {
var n = (xmlhttp.responseText.match(/txt/g) || []).length;
for (var i = 1; i < (n / 2); i++) {
$.get("projects/txt/" + i + ".txt", function(data) {
var line = data.split('\n');
var num = line[0] - "\n";
var clss = line[1];
var title = line[2];
var price = line[3];
var content = line[4];
$("#list-portfolio").append("<li class='item " + clss + " show' onclick='productSelection('" + num + "')'id='" + num + "'><img src='projects/src/" + num + "/title.jpg' class='lp_graphic'/><div class='item_header'><h1 class='title'>" + title + "</h1><h2 class='price'>" + price + "</h2></div><article class='item_content'>" + content + "</article></li>");
$("#full-size-articles").append("<li class='product " + num + "'><div><div class='photo_gallery'><div id='fsa_img_" + num + "'><div width='100%' class='firstgalleryitem of_" + num + "'></div></div></div><article class='content'><h1 class='header_article'>" + title + "</h1><h2 class='price_article'>" + price + "</h2><section class='section_article'>" + content + "</section></article></div></li>");
});
}
}
}
};
xmlhttp.open("GET", "projects/txt/", true);
xmlhttp.send();
}
有什么方法可以将代码转换为兼容宽度的https协议?