|
@@ -49,7 +49,7 @@ WebDataCenter = cc.Class({
|
|
|
|
|
|
|
|
httpGets:function (Url, CallBack) {
|
|
httpGets:function (Url, CallBack) {
|
|
|
this.m_LinkCount++;
|
|
this.m_LinkCount++;
|
|
|
- var xhr = cc.loader.getXMLHttpRequest();
|
|
|
|
|
|
|
+ var xhr = new XMLHttpRequest();;
|
|
|
xhr.onreadystatechange = function () {
|
|
xhr.onreadystatechange = function () {
|
|
|
if (xhr.readyState === 4 && (xhr.status >= 200 && xhr.status < 400)) {
|
|
if (xhr.readyState === 4 && (xhr.status >= 200 && xhr.status < 400)) {
|
|
|
this.m_LinkCount--;
|
|
this.m_LinkCount--;
|
|
@@ -78,7 +78,7 @@ WebDataCenter = cc.Class({
|
|
|
},
|
|
},
|
|
|
httpPosts:function (Url, CallBack) {
|
|
httpPosts:function (Url, CallBack) {
|
|
|
this.m_LinkCount++;
|
|
this.m_LinkCount++;
|
|
|
- var xhr = cc.loader.getXMLHttpRequest();
|
|
|
|
|
|
|
+ var xhr = new XMLHttpRequest();
|
|
|
xhr.onreadystatechange = function () {
|
|
xhr.onreadystatechange = function () {
|
|
|
if (xhr.readyState === 4 && (xhr.status >= 200 && xhr.status < 400)) {
|
|
if (xhr.readyState === 4 && (xhr.status >= 200 && xhr.status < 400)) {
|
|
|
this.m_LinkCount--;
|
|
this.m_LinkCount--;
|
|
@@ -114,13 +114,13 @@ WebDataCenter = cc.Class({
|
|
|
dataStr = dataStr.substring(0, dataStr.lastIndexOf('&'));
|
|
dataStr = dataStr.substring(0, dataStr.lastIndexOf('&'));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- var xhr = cc.loader.getXMLHttpRequest();
|
|
|
|
|
|
|
+ var xhr = new XMLHttpRequest();
|
|
|
xhr.open("POST", url, true);
|
|
xhr.open("POST", url, true);
|
|
|
xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=UTF-8");
|
|
xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=UTF-8");
|
|
|
xhr.onreadystatechange = function () {
|
|
xhr.onreadystatechange = function () {
|
|
|
if (xhr.readyState === 4 && (xhr.status >= 200 && xhr.status < 300)) {
|
|
if (xhr.readyState === 4 && (xhr.status >= 200 && xhr.status < 300)) {
|
|
|
let response = xhr.responseText.replace(/\s+/g, '');
|
|
let response = xhr.responseText.replace(/\s+/g, '');
|
|
|
- cc.log("post data return responseText: ", response);
|
|
|
|
|
|
|
+ console.log("post data return responseText: ", response);
|
|
|
callback(JSON.parse(response));
|
|
callback(JSON.parse(response));
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|