Here's my problem.
I have some link that trigger ajax function to load the content in a div. It working fine in Chrome and FireFox. However there is an issue in IE.It react funny. If i click on a link for the first time since the page is loaded it wont work as expected. It will load on the second click or if i mouse over the area that should be updated. And only IE react like that.
My Javascript function to query data
function req_frame(box,user,action,product) {
var xhr = getXMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState == 4 && (xhr.status == 200 || xhr.status == 0)) {
parent.frames[user].document.getElementById(box).innerHTML=xhr.responseText;
}
};
var sVar1 = product;
var sVar3 = encodeURIComponent(user);
var sVar2 = encodeURIComponent(action);
xhr.open("GET", "ajax_http.php?variable1=" + sVar3 + "&am开发者_运维技巧p;variable2=" + sVar2 + "&variable3=" + sVar1, true);
xhr.send(null);
}
I know this code is working cuse well it is! even tho the var are a lil mixed up
And i call this function using event triggering with Jquery like that
$("#ajphoto").live('click', function(){ req_frame("framebox","contpic","ajphoto","product"); })
Anyone wana help? Thanks
try this:
function req_frame(box,user,action,product) {
var result = $(parent.frames[user].document.getElementById(box));
result.load("ajax_http.php",
{variable1:user, variable2:action, variable3:product});
}
精彩评论