で正常に動作しますは、FirefoxとIE9のデータを取得できませんが、それはChromeとSafariの
function callCommentservice() {
try {
// Comment Service Url
var getCommentServiceUrl = self.commentsServiceUrl + self.getRating + "tenantId=" + self.tenantId + "&ratedObjectTypeId=" + self.ratedObjectTypeId + "&ratedObjectId=" + self.ratedObjectId + "&ratingType=" + self.ratingType + "&start=" + self.start + "&totalRecordsNeeded=" + self.totalRecordsNeeded;
$.ajax({
type: "GET",
url: getCommentServiceUrl,
contentType: "application/json",
timeout: 5000,
beforeSend: function (xhr) {
xhr.setRequestHeader("Accept", "application/json");
},
dataType: "json",
success: function (data) {
alert("I m in here.............!!!!");
// if (success == data) {
// Assigning totalRecordsNeeded value to global variable pagination_parameters.pageSize
pagination_parameters.pageSize = self.totalRecordsNeeded;
//Printing on a console.
debug("get comments url: " + getCommentServiceUrl);
// Calling Service in order to get data.
// $.getJSON(getCommentServiceUrl + "&callback=?", function (data) {
var emptyCommentHyperlink = document.getElementById('emptyCommentHyperlink');
// when there is no comment available in a service than this block will work.
if (data.length == 0) {
emptyCommentHyperlink.style.display = 'block';
//emptyCommentHyperlink.onclick = addCommentsBox;
$("#emptyCommentHyperlink").click(addCommentsBox);
}
else {
emptyCommentHyperlink.style.display = 'none';
}
//printing on a console.
debug("Date from the get service:" + data);
//alert(data);
// Changing date format of a service element AddedDateTime.
for (var key = 0; key < data.length; key++) {
var dataArray = data[key];
// Printing on console.
debug("data Array after the data object:" + dataArray);
var jsonDate = dataArray.AddedDateTime; //AddedDateTime is the service element.'
// Printing on a console.
debug("converted Time" + jsonDate);
var oneSecond = 1000; // milliseconds in one seconds
// changing format of the AddedDateTime
var date = new Date(parseInt(jsonDate.substring(6)));
var year = date.getFullYear(); // 2011
var day = date.getDay();
var exactdate = date.getDate();
var month = date.getMonth();
var hours = date.getHours();
var minutes = date.getMinutes();
var month_names_short = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
// Fromating Absolute time over tooltip.
if (hours > 12) {
hours = hours - 12;
var exact = zeroPad(hours) + ":" + zeroPad(minutes) + " PM" + ", " + exactdate + " " + month_names_short[month] + " " + year;
}
else {
var exact = zeroPad(hours) + ":" + zeroPad(minutes) + " AM" + ", " + exactdate + " " + month_names_short[month] + " " + year;
}
// subtracting current date with the comment date.
var finalDate = Math.abs(new Date() - date)/oneSecond;
dataArray.time_duration = new TimeSpan(finalDate).toString();
// Printing on a console.
debug("finalDate: " + dataArray.time_duration);
//alert(dataArray.time_duration);
dataArray.Absolute_Date = exact;
}
// Extracting TotalCount from service.
var totalComments = data[0].TotalCount;
// alert(totalComments);
//Calling paging Function
pages(totalComments);
//Making the commenttable empty.
$('#commentDiv').empty();
// Printing on a console.
debug("data before mactache" + data);
var comments = { "Comments": data };
var html = Mustache.to_html(self.template_html, comments);
var target_div = document.getElementById("commentDiv");
target_div.innerHTML = html;
//alert("target_div");
// });
},
// },
error: function (xhr, ajaxOptions, thrownError) {
debug(xhr);
var errorMsg = document.getElementById('ErrorLable');
errorMsg.style.display = "block";
}
});
}
catch (err) {
//Printing on a console.
debug("callCommentservice");
debug(err);
}
}
ChromeとSafariのが、中に正常に動作し、この方法IE 9とFirefox、私にでは動作しません次のようにFirefoxのリクエストヘッダにエラー405を受け取るである: -
応答ヘッダが
GETのContent-Length 1565 コンテンツタイプがtext/htmlのを許可します。 charset = UTF-8サーバーMicrosoft-IIS/7.5 X-Powered-By ASP.NET アクセス制御許可のOrig ... * アクセス制御を許可する... POST、GET、 オプションアクセス-control許ヘッド... CONTENT-TYPE、 は、アクセス・コントロール・マックス・エイジ1728000 日水曜日、14を受け入れ、2011年12月10時30分43秒GMTリクエストヘッダのホストservices.farooq.tv ユーザー-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0.1)Gecko/20100101 Firefox/8.0.1 text/html、application/xhtml + xml、application/xml; q = 0.9、/ ; q = 0.8 Accept-Language en-us、en; q = 0.5 Accept-Encoding GZIP、 のAccept-文字セットISO-8859-1を収縮させる、UTF-8; Q = 0.7、*; Q = 0.7 接続キープアライブ 起源http://marketplace.softech-lp35.softech.us アクセス制御リクエストミー... GET アクセス制御-Request-He ... content-type
「Firefoxはデータを取得しますが、Fire foxでは正常に動作します」? – thirtydot
ヘッダーのフォーマットが不適切で、切り詰められています。あなたはそれらをより読みやすく投稿できますか?いずれにしても、HTTPエラー405は、サーバーがリクエストに不満を持っているように聞こえるため、オペレータに尋ねる必要があります。 – RoToRa
しかし、なぜオペレーターはfirefoxとI.Eの場合にのみ不幸なのですか?クロムとサファリの場合はどうですか? –