🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.javascript
Article #51226

Re: Problem z XMLHttpRequest

#51226
From: nkab
Date: Thu, 06 Dec 2012 09:39
36 lines
2585 bytes
W dniu wtorek, 13 listopada 2012 23:53:26 UTC+1 użytkownik jaro napisał:
> > [1] Czy wywo�ujesz request XHR jeden po drugim, ale czekaj�c, a� 
> 

> 
> Wywołuję poprzez xmlhttp.open("GET","xxx.php"+"?ssid="+Math.random(),true);
> czyli asynchronicznie

Moze jak zajrzysz do kesza to będziesz miał odpoowiedź.

Prawdopodobnie ten random wali ci niezliczoną ilość plików
w keszu co wydłuża szukanie ostatniego pliku,
ja bym zrobił tak: ...GET","xxx.php"+"?" to spowoduje,
że masz jeden plik wymiany w keszu, w którym aktualizowana
jest treść. Również jak serwer umożliwia tryb POST dla ajaksa
to wszystko działa jak ta lala.

W PHP należy dać takie hidery:
<?php
//Set no caching
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); 
header("Cache-Control: no-store, no-cache, must-revalidate"); 
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
?> 

a w html:
<meta http-equiv="cache-control" content="no-cache">

Niestety coś w przeglądarkach pogmatawali i moje
dawne aplikacje ajaksowe przestały prawidłowo działać
musiałem poprzerabiać wszystko na refresze (chodzi jedną nazwę
pliku wymiany). Gorsze to ale niezawodne.

Andrzej.
Technical Details
Message-ID: <0a3509b0-6e2d-4b39-8dbd-a8f9af1ac404@googlegroups.com>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!agh.edu.pl!news.agh.edu.pl!news.cyf-kr.edu.pl!news.nask.pl!news.nask.org.pl!newsfeed.pionier.net.pl!news.glorb.com!kt20no12380821pbb.1!news-out.google.com!6ni28943pbd.1!nntp.google.com!kt20no12380817pbb.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
References: <34127733-0f56-4d5a-98ac-a4c369cabc72@googlegroups.com> <b2a08921-4912-478e-8948-333845862958@googlegroups.com> <k7rkrt$f9k$1@speranza.aioe.org> <494a63b4-4489-4ed2-ac95-008e1a314409@googlegroups.com> <k7u9hn$h2h$1@speranza.aioe.org> <2d9607ed-695f-42aa-a7ca-3eb9a79fd45a@googlegroups.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!agh.edu.pl!news.agh.edu.pl!news.cyf-kr.edu.pl!news.nask.pl!news.nask.org.pl!newsfeed.pionier.net.pl!news.glorb.com!kt20no12380821pbb.1!news-out.google.com!6ni28943pbd.1!nntp.google.com!kt20no12380817pbb.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups: pl.comp.lang.javascript
Date: Thu, 6 Dec 2012 01:39:13 -0800 (PST)
In-Reply-To: <2d9607ed-695f-42aa-a7ca-3eb9a79fd45a@googlegroups.com>
Complaints-To: groups-abuse@google.com
Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=31.183.101.120; posting-account=xnOwqAoAAAAJ48pUkVrL2a6sJByqdB8s
NNTP-Posting-Host: 31.183.101.120
References: <34127733-0f56-4d5a-98ac-a4c369cabc72@googlegroups.com> <b2a08921-4912-478e-8948-333845862958@googlegroups.com> <k7rkrt$f9k$1@speranza.aioe.org> <494a63b4-4489-4ed2-ac95-008e1a314409@googlegroups.com> <k7u9hn$h2h$1@speranza.aioe.org> <2d9607ed-695f-42aa-a7ca-3eb9a79fd45a@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <0a3509b0-6e2d-4b39-8dbd-a8f9af1ac404@googlegroups.com>
Subject: Re: Problem z XMLHttpRequest
From: nkab@toya.net.pl
Injection-Date: Thu, 06 Dec 2012 09:39:13 +0000
Lines: 39
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit