I have a problem trying to make a ajax GET request. I need to figure out how to transform my jquery to the original method using XDR. Here is my code. and here is what I want to add. I know where to add it, I just dont know how or where to place all my variables. So heres what I have :
我在尝试制作ajax GET请求时遇到问题。我需要弄清楚如何使用XDR将我的jquery转换为原始方法。这是我的代码。这就是我要添加的内容。我知道在哪里添加它,我只是不知道如何或在哪里放置我的所有变量。所以我拥有的东西:
$.post("post.php?"+$("#MYFORM").serialize(), {
}, function(response){
if(response==1 && codeVal == 1 && telVal == 1)
{
$("#after_submit").html('');
$("#Send").after('<label class="success" id="after_submit">Η αποστολή πραγματοποιήθηκε</label>');
change_captcha();
clear_form();
$.ajax({
type:'GET',
cache: false,
url: "web.something.gr/submit_code.php",
data:{ user: "123456", pass: "123456", source: "WEB", receipt: num, msisdn: phone},
success: function(data) {
var qsFull = "web.something.gr/submit_code.php?" + data;
var qs = URI(qsFull).query(true);
TINY.box.show({html:qs.message,animate:false,boxid:'error',top:5});
},
error: function(data) {
var qsFull = "web.mobilemedia.gr/input/microsoft/submit_code.php?" + data;
var qs = URI(qsFull).query(true);
TINY.box.show({html:qs.message,animate:false,boxid:'error',top:5});
}
});
}
else
{
$("#after_submit").html('');
$("#Send").after('<label class="error" id="after_submit">Error! in CAPTCHA .</label>');
}
});
This works in all browsers except IE.. so I want to fit this in there, but dont know how:
这适用于除IE之外的所有浏览器..所以我想在那里适合这个,但不知道如何:
if ($.browser.msie && window.XDomainRequest) {
// Use Microsoft XDR
var xdr = new XDomainRequest();
xdr.open("get", "someurl");
xdr.onload = function () {
var JSON = $.parseJSON(xdr.responseText);
if (JSON == null || typeof (JSON) == 'undefined')
{
JSON = $.parseJSON(data.firstChild.textContent);
}
processData(JSON);
};
xdr.send();
}
And I dont really think I use JSON, just text/html so What is my next step to make this happen. Becuase I have this working on every other browser.. Is it a syntax error, Do I really need this If statement? Please help.
我真的不认为我使用JSON,只是text / html所以我的下一步是什么才能实现。因为我在其他所有浏览器上都有这个工作..这是一个语法错误,我真的需要这个If语句吗?请帮忙。
1 个解决方案
#1
0
Apply this code clause; "data.firstChild.textContent" doesn't work in IE
应用此代码条款; “data.firstChild.textContent”在IE中不起作用
if(isIE() && isIE() < 10) {
JSON = $.parseJSON(data.text); }
function isIE() {
var myNav = navigator.userAgent.toLowerCase();
return (myNav.indexOf('msie') != -1) ? parseInt(myNav.split('msie')[1]) : false;}
#1
0
Apply this code clause; "data.firstChild.textContent" doesn't work in IE
应用此代码条款; “data.firstChild.textContent”在IE中不起作用
if(isIE() && isIE() < 10) {
JSON = $.parseJSON(data.text); }
function isIE() {
var myNav = navigator.userAgent.toLowerCase();
return (myNav.indexOf('msie') != -1) ? parseInt(myNav.split('msie')[1]) : false;}