Ajax and IE8 Issue
I have been having a look to some post here related to the post Im writing now but I can not solve it. The issue is that I have need some data from a php located in my server and make a call in the next manner:
function login(tipo) {
var xml = null;
try{
// Firefox, Opera 8.0+, Safari
xml=new XMLHttpRequest();
}catch (e){
// Internet Explorer
try{
xml=new ActiveXObject("Msxml2.XMLHTTP");
}catch (e){
try{
xml=new ActiveXObject("Microsoft.XMLHTTP");
}catch (e){
alert("Your browser does not support AJAX!");
return false;
}
}
}
xml.open("POST", "https://www.domoindal.com/mainSite/es/checklogin.php", false);
xml.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xml.send("u开发者_StackOverflow中文版ser="+document.loginForm.user.value+"&pass="+document.loginForm.pass.value);
if(xml.status == 404) alert("Url no valida");
var respuesta = xml.responseText.split("#", 3);
..... and this code works fine in Safari, Chrome and Firefox, the only exception is IE8. It arises an error in the responseText line (the last one).
Another similar question related to IE8 is that I want to change the image in a div and I use the next code:
function boton_1() {
$("#contenedor_tarjetas").html( '<img src="../images/VISA.png" width="250" height="40" />' );
$("#cardID").value = 1;
return true;
}
.... it gives me an error in the second line. What happens with this browser?? It seems like if it needs a separated program. I checked all kind of stuff and advices from other post with no success.
Is there anything missing? Whats wrong?
If someone could help me I would appreciate it a lot.
Thanks in advance.
At least I found the solution to the query I did. The fact is that there is a little problem with IE8 and the Ajax. When you make a query to a php in the server and you wait for an answer, the data is returned in a charset different than IE8 usually works. Its the only browser that has this problem.
So i solved it including in the PHP file a header in the next way:
header('Content-type: text/plain; Charset=utf-8');
So, if someone else has this problem, try with this.
I hope I could solved to anyone this problem.
精彩评论