我的网页中有两个 ajax 回调函数。正如您在标题中看到的那样,存在一个问题。这是我的代码:
$.ajax({
type: "POST",
url: "http://....com/Ap.aspx/GetPriceList",
data: "{categoryId:" + categoryId + "}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
var priceList = JSON.parse(data.d);
$(function () {
$("#slider-range").slider({
range: true,
min: priceList[0],
max: priceList[1],
values: [priceList[0], priceList[1]],
slide: function (event, ui) {
$("#amount").val(ui.values[0] + " (TL)" + " - " + ui.values[1] + " (TL)");
},
change: function (event, ui) {
// alert(ui.values[0]);
// alert(ui.values[1]);
}
});
$("#amount").val($("#slider-range").slider("values", 0) + " (TL)" + " - " + $("#slider-range").slider("values", 1) + " (TL)");
$("#" + "<%=lblProductCount.ClientID %>").text("Listelenen ürün sayısı :" + priceList[2]);
var btnLoadMore = ' <input type="button" alt="Daha Fazla Ürün Yüklemek İçin Buraya Tıklayın" class="moreProduct" onclick="LoadMore();"/>';
$("#load").html(btnLoadMore);
});
}
});
我在 chrome 开发人员的工具中看到了这个错误。XMLHtttpRequest cannot load
url. Origin domain name is not allowed by Access-Control-Allow-Origin.
我也尝试Response.AppendHeader("Access-Control-Allow-Origin", "*");
在我的母版页的页面加载事件上写。你有什么建议吗?