Article View: pl.comp.lang.javascript
Article #50384javascript - pobieranie pliku - jakiś koszmar!!! RATUNKU!!!
From: bobas
Date: Sat, 13 Nov 2010 17:53
Date: Sat, 13 Nov 2010 17:53
51 lines
2518 bytes
2518 bytes
Witam
Chcę ładować fragmenty strony z serwera (pobierając asynchronicznie).
Postawiłem nginx na localhost i w przeglądarce wyświetla wszystkie pliki
jakie skopiowałem do katalogu nginx\html\. Ale skrypt mi nie chce
działać!!! Męczę się z nim już 2 dzień!!! Proszę o pomoc w tej sprawie.
Niżej zawartość mojego pliku index.html:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl">
<head>
<title>test funkcji z parametrami</title>
<meta name="Keywords" content=""/>
</head>
<div id="page div"></div>
<script type="text/javascript">
var lConnection = null;
function downloadPage(aPath)
{
lConnection = new XMLHttpRequest();
if(lConnection)
return;
lConnection.onreadystatechange = downloaded("page");
lConnection.open("GET", aPath);
lConnection.send(null);
}
function downloaded(aType)
{
if(!lConnection || lConnection.readyState != 4)
return;
if(aType != "page")
{
var lPage = document.getElementById("page div");
lPage.innerHTML = lConnection.responseText;
}
}
var lPage = "/strona - strona gluvna.txt";
</script>
<form name="get" method="get"><input type="button" value="pobierz
zawartosc" onClick="downloadPage(lPage);"></form>
</body>
</html>
Technical Details
Message-ID:
<4ce0460c$0$27041$65785112@news.neostrada.pl>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.rmf.pl!agh.edu.pl!news.agh.edu.pl!news.onet.pl!news.nask.pl!news.nask.org.pl!newsfeed2.atman.pl!newsfeed.atman.pl!newsfeed.neostrada.pl!unt-exc-01.news.neostrada.pl!unt-spo-b-01.news.neostrada.pl!news.neostrada.pl.POSTED!not-for-mailShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.rmf.pl!agh.edu.pl!news.agh.edu.pl!news.onet.pl!news.nask.pl!news.nask.org.pl!newsfeed2.atman.pl!newsfeed.atman.pl!newsfeed.neostrada.pl!unt-exc-01.news.neostrada.pl!unt-spo-b-01.news.neostrada.pl!news.neostrada.pl.POSTED!not-for-mail Date: Sat, 13 Nov 2010 18:53:56 +0100 From: bobas <bobaskonto@o2.pl> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; pl; rv:1.9.2.12) Gecko/20101027 Thunderbird/3.1.6 MIME-Version: 1.0 Newsgroups: pl.comp.lang.javascript Subject: javascript - pobieranie pliku - jakiś koszmar!!! RATUNKU!!! Lines: 51 Message-ID: <4ce0460c$0$27041$65785112@news.neostrada.pl> Organization: Telekomunikacja Polska NNTP-Posting-Host: 83.20.10.68 X-Trace: 1289766412 unt-rea-a-02.news.neostrada.pl 27041 83.20.10.68:1906 X-Complaints-To: abuse@news.neostrada.pl Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit