开发者

Ajax code control

Sorry for that stupid question but, is this code right because it seems to be broken.

var request_type; 
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
    request_type = new ActiveXObject("Microsoft.XMLHTTP");
}else{
    request_type = new XMLHttpRequest();
}
return request_type;
}

var http = createObject();

var nocache = 0;
function vloz() {

var kom= encodeURI(document.getElementById('komen').value);
var site_name = encodeURI(document.getElementById('user_id').value);
var p_id = encodeURI(document.getElementById('p_id').value);
var zed = encodeURI(document.getElementById('zed').value);

nocache = Math.random();
http.open('get', 'kmnt.php?site_url='+kom+'&site_name=' +site_name+'&site='+p_id+'&    zed='+zed+'&nocache = '+nocache);
http.onreadystatechange = insertReply;
http.send(null);
}
function insertReply() {
    if(http.readyState == 4){
    }
}

I have a form when i am sendin开发者_如何学Cg komen, user_id, p_id and zed


Not sure if this is it but it appears that you have one too many curly braces in the beginning of your code:

if(browser == "Microsoft Internet Explorer") {
    request_type = new ActiveXObject("Microsoft.XMLHTTP");
} else {
    request_type = new XMLHttpRequest();
}
return request_type;

// }   <- extra one here
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜