2011-10-06 4 views
-1

하지만,이 코드 권리입니다.Ajax 코드 제어

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){ 
    } 
} 

내가 보내고 양식을 가지고 코멘 266 p_id와 데이빗

+0

당신이 오류의 종류를 볼 수 있습니까 ? 아이오와 그 쿼리 않네는 오류 메시지를 얻을 수 있도록 내가 방화 광/파이어 폭스를 사용하는 것이 좋습니다 –

+0

@AllenLiu 난 .. 단지 아약스로 시작하는 오류, 메신저를 볼하지만 어차피 (있는 경우)를 JavaScript에서 가져옵니다. http://getfirebug.com/javascript –

+0

을 삽입 볼 수 있습니다 MySQL은 INSERT 쿼리가 kmnt.php의 내부 –

답변

0

이 그것을하지만 당신이 코드의 시작 부분에 너무 많은 중괄호가 나타납니다 확실하지 :

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

// } <- extra one here 
관련 문제