![]() |
|
||||||||||
|
|||||
|
[+1.3 14.04.09]
Регистрация: May 2006
Сообщений: 113
|
Перечитал документации а так и не работает как нужно, все перепробывал.
Имеется файл ХМL header("Content-Type: text/xml;charset=windows-1251"); <?xml version="1.0" encoding="windows-1251" ?>
group>
<url id="1">
<from>http://www.nitobi.com/products/combobox/?_kk=ajax%20html&_kt=eb785e25-1806-4523-8e49-72d6e556161d&gclid=CNrvvKbytJQCFQoTuwodqUn4Tg&gid=CNrvvKbytJQCFQoTuwodqUn4Tg&d=CNrvvKfsdgfgTg</from>
<main>main</main>
<other>other</other>
<buy>buy</buy>
</url>
<url id="2">
<from>from2</from>
<main>main2</main>
<other>other2</other>
<buy>buy2</buy>
</url>
<url id="3">
<from>from3</from>
<main>main3</main>
<other>other3</other>
<buy>buy3</buy>
</url>
</group>
И вот JavaScript для чтения XML header("Content-Type: text/html;charset=windows-1251"); <script>
function createRequestObject(){
if (window.XMLHttpRequest){
try{
return new XMLHttpRequest();
} catch (e){}
} else if (window.ActiveXObject){
try{
return new ActiveXObject('Msxml2.XMLHTTP');
} catch (e){}
try{
return new ActiveXObject('Microsoft.XMLHTTP');
} catch (e){}
}
return null;
}
function load(url, hobj){
if (canloading==true){
canloading=false;
htmlobj=hobj;
request.onreadystatechange = loaded;
//request.open('POST', 'create_report.php?site_stat=true&' + url, true);
request.open('POST', 'xml/file.txt', true);
document.getElementById(htmlobj).innerHTML='<img src="images/ajax-loader.gif">';
document.getElementById('off_' + htmlobj).style.visibility='visible';
document.getElementById('on_' + htmlobj).style.visibility='hidden';
request.send("");
}
}
function loaded(){
if (request.readyState == 4) {
xmlobj = (request.responseXML);
request.abort();
xmlroot = xmlobj.documentElement;
alert(xmlroot);
canloading=true;
}
}
function close_stat(htmlobj){
if (canloading==true){
document.getElementById('off_' + htmlobj).style.visibility='hidden';
document.getElementById('on_' + htmlobj).style.visibility='visible';
}
}
htmlobj=0;
canloading=true;
request = createRequestObject();
//htmlobject;
</script>
parsed=true зато parseError.errorCode = -1072897514 parseError.reason = Требуется точка с запятой. Я так понимаю что это изза слишком большого from в xml документе поскольку если поставить маленькое значение в поле то возвращает объект без ошибок. Как эту проблему побороть? Последний раз редактировалось der hund; 10.07.2008 в 13:37. |
|
|||||
|
.grin! wuz here
|
ниахота разбираться в куче
http://htmlcoder.visions.ru/JavaScript/?30 мб поможет...
__________________
Breakcore them all! |
|
|||||
|
[+1.3 14.04.09]
Регистрация: May 2006
Сообщений: 113
|
to wvxvw. Есть вы правы. Спасибо. Все работает.
|
![]() |
![]() |
Часовой пояс GMT +4, время: 15:10. |
|
|
« Предыдущая тема | Следующая тема » |
|
|