döner aynı sonucu çağırır ve onlara async
sesleniyorum:İki İki <a href="/questions/tagged/ajax" class="post-tag" title="show questions tagged 'ajax'" rel="tag">ajax</a> çağrıları var
xmlhttpPostInstagram2('firsturl');
xmlhttpPostInstagram3('secondurl');
Sorun iki çağrı ile aynı sonuçları alıyorum olduğunu. Eşitlemek için async
değiştirirsem, beklenen sonuç olan iki farklı sonuç alıyorum. Ajax async
numaralı telefonu arayarak ne diyebiliriz?
jquery'u kullanmak istemiyorum. javascript cevabı takdir edilecektir. jQuery kullanmadan
function xmlhttpPostInstagram2(strURL) {
var originalValue = ""
var xmlHttpReq = false;
var self = this;
// Mozilla/Safari
if (window.XMLHttpRequest) {
self.xmlHttpReq = new XMLHttpRequest();
}
// IE
else if (window.ActiveXObject) {
self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
}
self.xmlHttpReq.open('POST', strURL, true);
self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
self.xmlHttpReq.onreadystatechange = function() {
if (self.xmlHttpReq.readyState == 4) {
var temp2 = document.getElementById('sidebartag');
temp2.innerHTML = self.xmlHttpReq.responseText; // child is the fetched string from ajax call in your case
}
}
self.xmlHttpReq.send();
}
ve
function xmlhttpPostInstagram3(strURL) {
var originalValue = ""
var xmlHttpReq = false;
var self = this;
// Mozilla/Safari
if (window.XMLHttpRequest) {
self.xmlHttpReq = new XMLHttpRequest();
}
// IE
else if (window.ActiveXObject) {
self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
}
self.xmlHttpReq.open('POST', strURL, true);
self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
self.xmlHttpReq.onreadystatechange = function() {
if (self.xmlHttpReq.readyState == 4) {
var temp2 = document.getElementById('sidebartag1');
temp2.innerHTML = self.xmlHttpReq.responseText; // child is the fetched string from ajax call in your case
}
}
self.xmlHttpReq.send();
}
Ben senin sorunun bir kapsam sorunu olduğunu düşünüyorum. Cevabımı kontrol edin ve yardımcı olup olmadığını görün. –