Javascript-форум (https://javascript.ru/forum/)
-   jQuery (https://javascript.ru/forum/jquery/)
-   -   не отрабатывает скрипт в IE (https://javascript.ru/forum/jquery/61837-ne-otrabatyvaet-skript-v-ie.html)

oryth 11.03.2016 10:20

не отрабатывает скрипт в IE
 
подскажите пожалуйста почему в IE не отрабатывает скрипт:
function getperson2(){
	var s = document.getElementById("fio").value;
	var ff = document.getElementById("findfio");
	if (s.length < 3) {
		ff.style.display = "none";
		document.getElementById("depart").value = '';
		document.getElementById("prof").value = '';
		document.getElementById("phone").value = '';
	}else{
		ff.style.display = "block";
		var xmlhttp;
		if (window.XMLHttpRequest){
			xmlhttp=new XMLHttpRequest();
		}
		xmlhttp.onreadystatechange=function(){
			if (xmlhttp.readyState==4 && xmlhttp.status==200){
				ff.innerHTML = xmlhttp.response;
			}
		}
		xmlhttp.open("GET","getpersons2.asp?fio="+s,true);
		xmlhttp.send();	
		
	}
}

destus 11.03.2016 10:42

oryth,
function getXmlHttp(){
	try {
		return new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
			return new ActiveXObject("Microsoft.XMLHTTP");
		} catch (ee) {
		}
	}
	if (typeof XMLHttpRequest!='undefined') {
		return new XMLHttpRequest();
	}
}

oryth 11.03.2016 10:45

destus,простите, а куда это вставить?

destus 11.03.2016 10:47

function getXmlHttp(){
	try {
		return new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
			return new ActiveXObject("Microsoft.XMLHTTP");
		} catch (ee) {
		}
	}
	if (typeof XMLHttpRequest!='undefined') {
		return new XMLHttpRequest();
	}
}

function getperson2(){
	var s = document.getElementById("fio").value;
	var ff = document.getElementById("findfio");
	if (s.length < 3) {
		ff.style.display = "none";
		document.getElementById("depart").value = '';
		document.getElementById("prof").value = '';
		document.getElementById("phone").value = '';
	}else{
		ff.style.display = "block";
		var xmlhttp = getXmlHttp();
		xmlhttp.onreadystatechange=function(){
			if (xmlhttp.readyState==4 && xmlhttp.status==200){
				ff.innerHTML = xmlhttp.response;
			}
		}
		xmlhttp.open("GET","getpersons2.asp?fio="+s,true);
		xmlhttp.send();	
		
	}
}

oryth 11.03.2016 10:58

к сожалению, не хочет, такая мысль, что не передается параметр s, так как если написать в getpersons2.asp просто написать текст то он его вставляет вот кстати код getpersons2.asp
fiof = request.querystring("fio")
	sql = "SELECT * "
	sql = sql & "FROM таблица "
	sql = sql & "WHERE Full_Name LIKE '" & fiof & "%' ORDER BY Full_Name"
	set conn = Server.CreateObject("ADODB.Connection")
	Conn.Open "string connection......"
	set rs = Server.CreateObject("ADODB.recordset")
	rs.Open sql,conn
	resp = "<table class=""tff"" cellspacing=""0"">" 
	do while not rs.eof
		resp = resp & "<tr id=""" & rs("num_tab") & """ onclick=""clickff(this.id);"">"
		resp = resp & "<td class=""tffc1"">" & rs("Full_Name") & "</td>"
		resp = resp & "<td class=""tffc2"">" & rs("firm") & "</td>"
		resp = resp & "<td>" & rs("Expr1") &"</td>"
		resp = resp & "<td>" & rs("Name_appoint") & "</td>"
		resp = resp & "</tr>" 
		rs.Movenext
	loop
	resp = resp & "</table>"
	response.write(resp)
	rs.close: set rs=nothing
	conn.close

oryth 11.03.2016 10:59

в других броузерах все работает, а вот в IE нет

oryth 11.03.2016 11:15

в IE вставляет не таблицу, а undefined

oryth 11.03.2016 15:12

добился что выводит квадраты, я так понимаю все браузеры кроме IE передает в utf8, а вот ie видимо в 1251, поэтому квадраты. как сделать что принудительно поставить utf-8?

destus 11.03.2016 15:17

https://www.w3.org/International/art...arset/index.ru

oryth 11.03.2016 15:44

стоит IIS 7.5 по умолчанию на весь сайт кодировка utf-8, все файлы написаны в кодировки utf-8 не понимаю, так полагаю что ошибка в этой в строке :
xmlhttp.open("GET","getpersons2.asp?fio="+s,false) ; - видимо s передается в кодировке не utf-8, при выводе этого параметра выводятся квадраты если выводить на английском то нормально все


Часовой пояс GMT +3, время: 02:42.