Ajax IE8 Issue

xscottehx

Member
Hi All,

I am using Progress 10.2b and IE8 with ajax and jquery. I have also tried using a non-jquery solution which still doesnt work. I previously tested my solution in IE7 which worked fine. I hope someone can help, i have looked on many forums and got nowhere.

My jquery code is:

Code:
                 $.ajax({
                          type: "POST",
                          url: "[URL="http://vertucentral.com/central/www/act/my_vertu.p"]myurl[/URL]",
                          cache: false,
                          data: { val1 : $("input[name=Q1]").val(),
                                  val2 : $("input[name=Q2]").val(),
                                  val3 : $("input[name=Q3]").val(),},
     error: function(d){
            alert("There was an error grabbing data");
     },
                          success: function(d){
                              alert ("Working");
                          }
                        })

With the above code when i submit the form i get a javascript error flash up but i dont know what it says. This code works in FF.

using an alternative method:

Code:
   var xmlhttp;
   if (window.ActiveXObject)
     {
     xmlhttp=new ActiveXObject("Microsoft.XMLHttp");
     }
   else
     {
     xmlhttp=new XMLHttpRequest();
     } 
   xmlhttp.onreadystatechange=function()
     { 
     if (xmlhttp.readyState==4 && xmlhttp.status==200)
       { 
       document.getElementById("#1").innerHTML=xmlhttp.responseText;
       }
 
     xmlhttp.open("POST","[URL="http://vertumotors.com/central/www/act/my_vertu.p?sname=Ward&fname=Simon",true"]myurl?val1=hello&val2=test&val3=values",true[/URL]);
     xmlhttp.send();
 
     }

Again i get the same response. When putting alert messages in here it only gets as far as creating a new ActiveXObject and then nothing else. Even when taking the .open and .send procedures outside of the onstagechange function it doesnt display the alert messages around them.

Any help would be appreciated ive spent hours searching for solutions.

Scott
 
You say a error message flashes up before the page is reloaded. I'm guessing you are executing the JQuery AJAX post from within a html form.

If that is the case please can you put a target attribute on the form of taget="_blank". This should the calling URL into a new tab/windows leaving behind the error message from the source page.

Basically if your JavaScript is failing, the default behavior of the form is being processed.

I can't tell you what's why is not working however IE and FF can handle Javascript code very slightly and IE is a bit more strict on the coding syntax, where FF can be a little bit more forgiving.

I've noticed on your JQuery example that there looks like an extra comer after the 3rd parameter (I don't think this is needed). FF might just ignore this but IE is just ****ting it's self about it and won't handle the JavaScript.
 
Thanks for your help. After going back to the jquery ajax version i went over the syntax. The comma at the end of the data parameters was allowing the code to run but was causing an error when submitting. All resolved now and works perfectly in IE8. Damn you IE8!
 
Back
Top