1

I tried to open a post time ago about this problem (here), thinking i was wrong making the code. Now more or less i've understood that some version of Jquery with my code doesnt work on IE7. What's Happening? I also tried to open a post on JQuery official forum (link) but no one reply. Anyway, in my old website i used to work with jquery-1.3.2.min.js , and i didnt problems. Now, i need to use the .delegate() function, so I include the jquery-1.4.2.min.js library.

Above you can see the usual code I used in my old application :

// html page
<a href="#" onClick="pmNew('1');return false">prova</a>    

// javascript page
function pmNew(mexid) {
    var time = new Date;
    $.ajax({
        type: 'POST',
        url: './folder/ajax.php',
        data: 'mexid='+escape(mexid)+'&id=pmnew',
        success: function(msg) {
            alert(msg);
        }
    });
    return false;
}

// asynchf.php
if($_POST['id']=="pmnew") {
    echo "please, i will just print this";
}

With some suggestions by some users of this website, i edited these functions :

// html page
<a href="#" onClick="pmNew('1');return false">prova</a>    

// javascript page
function pmNew(mexid) {
    var time = new Date;
    $.ajax({
        type: 'POST',
        cache: false,
        url: './folder/ajax.php' + '?dummy=' + time.getTime(),
        data: 'mexid='+escape(mexid)+'&id=pmnew',
        success: function(msg) {
            alert(msg);
        }
    });
    return false;
}

// asynchf.php
if($_POST['id']=="pmnew") {
    echo "please, i will just print this";
}

But it STILL DOESNT WORK on IE7. Firefox, Chrome, it rocks. It works on IE7 only if i load the page, i try (and i get the error message), i reload (F5) and i retry. Or, as i said before, i change the version of Jquery :)

I loaded a testpage on a real server (so you can check yourself this problem) : click here

I hope someone can help me with this big trouble.

Cheers

Community
  • 1
  • 1
markzzz
  • 47,390
  • 120
  • 299
  • 507
  • What's the actual error message ? – Russ Clarke Sep 20 '10 at 09:16
  • Uhm. It doesnt return nothing. I think it do the ajax call. IE say Code :0 Access Denied – markzzz Sep 20 '10 at 09:23
  • As others have said, you should probably check out "Fiddler", http://www.fiddler2.com/fiddler2/. This will show you what IE is actually trying to send to your PHP page. – Russ Clarke Sep 20 '10 at 09:27
  • I also tried to write ipv4.fiddler than localhost on browser, but when i click on that function nothing appair... – markzzz Sep 20 '10 at 09:51
  • Uhm. I've uploaded this page on real server. You can check at http://www.gabbatracklistworld.com/index.php?general=example4 – markzzz Sep 20 '10 at 10:02

2 Answers2

4

The reason behind this bug is when you are using relative URLs on IE7, it actually adds your base url (or wherever your page is loaded from e.g. if you place a relative url on your home page your relative URL would actually be http://gabbatracklistworld.com/http://gabbatracklistworld.com/folder/ajax.php)

I just came across your question here on SO while searching for a solution on some same problem I had myself a few minutes ago. There's actually an article from microsoft's blog that explains how IE7 handle relative urls (which is funny because it just shows that they are proud of how their stupid browser works) Seeing that you have no answer yet, I'd put my solution here for future reference and other devs too.

What I did is use substring() to strip the instances of my base url forcing the ajax request to use the actual relative URL.

lock
  • 6,404
  • 18
  • 58
  • 76
0

Can you add this argument to your .Ajax options:

error:function(xhr, status, errorThrown) {
            alert(errorThrown+'\n'+status+'\n'+xhr.statusText);
        }, 

and reply with the message ?

Russ Clarke
  • 17,511
  • 4
  • 41
  • 45
  • That's a shame; I was hoping it might be related to this: http://forum.jquery.com/topic/fix-jquery-ajax-errors-in-ie – Russ Clarke Sep 20 '10 at 10:12
  • uhm...but why? It works fine on jquery-1.3.2.min.js ... hehe! i loaded the page online, check it out the link... – markzzz Sep 20 '10 at 10:17
  • It was a hunch more than anything. Unfortunately, I don't have an IE7 box here, but Fiddler should work, I suspect you'll need to configure it to be your Proxy, for it to capture packets. This page has some details that might help: http://www.fiddler2.com/fiddler/help/hookup.asp – Russ Clarke Sep 20 '10 at 11:44
  • One more thought, what happens if you remove the period at the start of the path? – Russ Clarke Sep 20 '10 at 11:52
  • If i remove the period its the same. In fact it doesnt help...! About Fiddler, i have some problems with localhost. So i've uploaded a page on real server. It grabs the traffik now, but it grabs nothing when i call that function. Really, i dunno what's happened. I've thought to a virus on my pc, but a friend of mine get the same error with other pc and the same browser. A very mistery for me... – markzzz Sep 20 '10 at 15:17