I have a bizare Ajax POST problem.
I use Ajax POST to send data to the server.
The server get the POST and answer back.
BUT if I POST the data once again I recieve the same answer that the
first post give me, even if the answer is different. I have used HTTP
Analyser Std V2.1.1.15 and I see that the answer is different. But the
Ajax .responseText is the same as the first POST. It looks like it use
the cached respons.
In the RFC the client should never use the cache if it is a POST.
And to make sure I have added a new serial=xxxx in the POST URL for
eatch requests.
But still get the same result as the first POST into the JavaScript
(but the respons from the server IS different).
Here is the server responses from HTTP Analyser:
----------------------------------------
(Request-Line):POST /page.aspx?EditM aster=0&serial= 1159541629765
HTTP/1.1
Host:127.0.0.1
User-Agent:Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.7)
Gecko/20060909 Firefox/1.5.0.7
Accept:text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,ima ge/png,*/*;q=0.5
Accept-Language:nb
Accept-Encoding:gzip,d eflate
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive:300
Connection:clos e
Content-Type:applicatio n/x-www-form-urlencoded
Cache-Control:post-check=0, pre-check=0, no-cache
Pragma:no-cache, no-cache
Content-Length:3695
Cookie:WebSelec tTabWorkShiftWe bTab2=1; WebSelectTabRea lTPIWebTab2=2
-----------------------------------------
(Status-Line):HTTP/1.1 200 OK
Server:Microsof t-IIS/5.1
Date:Fri, 29 Sep 2006 14:53:49 GMT
X-Powered-By:ASP.NET
Connection:clos e
X-AspNet-Version:2.0.507 27
ABB:MES
Set-Cookie:ASP.NET_ SessionId=kfrv5 c55kbeefemshid2 ki45; path=/; HttpOnly
Cache-Control:no-cache
Pragma:no-cache
Expires:-1
Content-Type:text/html; charset=utf-8
Content-Length:239
Here is the JavaScript Code:
function AjaxFormPostItM akeRequest(url, data)
{
[snippet .. AjaxForm = new XMLHttpRequest( ) ... blabla]
AjaxForm.onread ystatechange = AjaxFormPostIta lertContents;
AjaxForm.open(' POST', url, true);
AjaxForm.setReq uestHeader("Con tent-Type",
"applicatio n/x-www-form-urlencoded");
AjaxForm.setReq uestHeader("Con tent-length", data.length);
AjaxForm.setReq uestHeader("Con nection", "close");
AjaxForm.setReq uestHeader("Cac he-Control", "no-store, no-cache,
must-revalidate");
AjaxForm.setReq uestHeader("Cac he-Control", "post-check=0,
pre-check=0");
AjaxForm.setReq uestHeader("Pra gma", "no-cache");
AjaxForm.send(d ata);
}
function AjaxFormPostIt( obj)
{
var getstr = '';
[ snippet - get all the post elements]
var timestamp = new Date().getTime( );
var url = '/page.aspx?EditM aster=0&serial= ' + timestamp;
AjaxFormPostItM akeRequest(url, getstr);
}
Anyone can help me out here - please?
GTi 9 3677
GTi wrote:
I have a bizare Ajax POST problem.
I use Ajax POST to send data to the server.
The server get the POST and answer back.
BUT if I POST the data once again I recieve the same answer that the
first post give me, even if the answer is different. I have used HTTP
Analyser Std V2.1.1.15 and I see that the answer is different. But the
Ajax .responseText is the same as the first POST. It looks like it use
the cached respons.
In the RFC the client should never use the cache if it is a POST.
And to make sure I have added a new serial=xxxx in the POST URL for
eatch requests.
But still get the same result as the first POST into the JavaScript
(but the respons from the server IS different).
Here is the server responses from HTTP Analyser:
----------------------------------------
(Request-Line):POST /page.aspx?EditM aster=0&serial= 1159541629765
HTTP/1.1
Host:127.0.0.1
User-Agent:Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.7)
Gecko/20060909 Firefox/1.5.0.7
Accept:text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,ima ge/png,*/*;q=0.5
Accept-Language:nb
Accept-Encoding:gzip,d eflate
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive:300
Connection:clos e
Content-Type:applicatio n/x-www-form-urlencoded
Cache-Control:post-check=0, pre-check=0, no-cache
Pragma:no-cache, no-cache
Content-Length:3695
Cookie:WebSelec tTabWorkShiftWe bTab2=1; WebSelectTabRea lTPIWebTab2=2
-----------------------------------------
(Status-Line):HTTP/1.1 200 OK
Server:Microsof t-IIS/5.1
Date:Fri, 29 Sep 2006 14:53:49 GMT
X-Powered-By:ASP.NET
Connection:clos e
X-AspNet-Version:2.0.507 27
ABB:MES
Set-Cookie:ASP.NET_ SessionId=kfrv5 c55kbeefemshid2 ki45; path=/; HttpOnly
Cache-Control:no-cache
Pragma:no-cache
Expires:-1
Content-Type:text/html; charset=utf-8
Content-Length:239
Here is the JavaScript Code:
function AjaxFormPostItM akeRequest(url, data)
{
[snippet .. AjaxForm = new XMLHttpRequest( ) ... blabla]
AjaxForm.onread ystatechange = AjaxFormPostIta lertContents;
AjaxForm.open(' POST', url, true);
AjaxForm.setReq uestHeader("Con tent-Type",
"applicatio n/x-www-form-urlencoded");
AjaxForm.setReq uestHeader("Con tent-length", data.length);
AjaxForm.setReq uestHeader("Con nection", "close");
AjaxForm.setReq uestHeader("Cac he-Control", "no-store, no-cache,
must-revalidate");
AjaxForm.setReq uestHeader("Cac he-Control", "post-check=0,
pre-check=0");
AjaxForm.setReq uestHeader("Pra gma", "no-cache");
AjaxForm.send(d ata);
}
function AjaxFormPostIt( obj)
{
var getstr = '';
[ snippet - get all the post elements]
var timestamp = new Date().getTime( );
var url = '/page.aspx?EditM aster=0&serial= ' + timestamp;
AjaxFormPostItM akeRequest(url, getstr);
}
Anyone can help me out here - please?
GTi
You need to set some Content Headers when your server resource replies:
Cache_control: no-cache
Pragma: no-cache
This will tell the UA to always get a new response, not use one from
cache.
Tom Cole wrote:
GTi wrote:
I have a bizare Ajax POST problem.
I use Ajax POST to send data to the server.
The server get the POST and answer back.
BUT if I POST the data once again I recieve the same answer that the
first post give me, even if the answer is different. I have used HTTP
Analyser Std V2.1.1.15 and I see that the answer is different. But the
Ajax .responseText is the same as the first POST. It looks like it use
the cached respons.
In the RFC the client should never use the cache if it is a POST.
And to make sure I have added a new serial=xxxx in the POST URL for
eatch requests.
But still get the same result as the first POST into the JavaScript
(but the respons from the server IS different).
Here is the server responses from HTTP Analyser:
----------------------------------------
(Request-Line):POST /page.aspx?EditM aster=0&serial= 1159541629765
HTTP/1.1
Host:127.0.0.1
User-Agent:Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.7)
Gecko/20060909 Firefox/1.5.0.7
Accept:text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,ima ge/png,*/*;q=0.5
Accept-Language:nb
Accept-Encoding:gzip,d eflate
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive:300
Connection:clos e
Content-Type:applicatio n/x-www-form-urlencoded
Cache-Control:post-check=0, pre-check=0, no-cache
Pragma:no-cache, no-cache
Content-Length:3695
Cookie:WebSelec tTabWorkShiftWe bTab2=1; WebSelectTabRea lTPIWebTab2=2
-----------------------------------------
(Status-Line):HTTP/1.1 200 OK
Server:Microsof t-IIS/5.1
Date:Fri, 29 Sep 2006 14:53:49 GMT
X-Powered-By:ASP.NET
Connection:clos e
X-AspNet-Version:2.0.507 27
ABB:MES
Set-Cookie:ASP.NET_ SessionId=kfrv5 c55kbeefemshid2 ki45; path=/; HttpOnly
Cache-Control:no-cache
Pragma:no-cache
Expires:-1
Content-Type:text/html; charset=utf-8
Content-Length:239
Here is the JavaScript Code:
function AjaxFormPostItM akeRequest(url, data)
{
[snippet .. AjaxForm = new XMLHttpRequest( ) ... blabla]
AjaxForm.onread ystatechange = AjaxFormPostIta lertContents;
AjaxForm.open(' POST', url, true);
AjaxForm.setReq uestHeader("Con tent-Type",
"applicatio n/x-www-form-urlencoded");
AjaxForm.setReq uestHeader("Con tent-length", data.length);
AjaxForm.setReq uestHeader("Con nection", "close");
AjaxForm.setReq uestHeader("Cac he-Control", "no-store, no-cache,
must-revalidate");
AjaxForm.setReq uestHeader("Cac he-Control", "post-check=0,
pre-check=0");
AjaxForm.setReq uestHeader("Pra gma", "no-cache");
AjaxForm.send(d ata);
}
function AjaxFormPostIt( obj)
{
var getstr = '';
[ snippet - get all the post elements]
var timestamp = new Date().getTime( );
var url = '/page.aspx?EditM aster=0&serial= ' + timestamp;
AjaxFormPostItM akeRequest(url, getstr);
}
Anyone can help me out here - please?
GTi
You need to set some Content Headers when your server resource replies:
Cache_control: no-cache
Make that Cache-Control (dash, not underscore)...S orry.
Pragma: no-cache
This will tell the UA to always get a new response, not use one from
cache.
Tom Cole wrote:
Cache-Control: no-cache
Pragma: no-cache
This will tell the UA to always get a new response, not use one from
cache.
A small correction: the last one (Pragma) doesn't handle the UA's cache
mechanics. It instructs the intermediary servers do not serve the
request from their proxies but to re-request the source server (where
understood of course).
VK wrote:
Tom Cole wrote:
Cache-Control: no-cache
Pragma: no-cache
This will tell the UA to always get a new response, not use one from
cache.
A small correction: the last one (Pragma) doesn't handle the UA's cache
mechanics. It instructs the intermediary servers do not serve the
request from their proxies but to re-request the source server (where
understood of course).
Is't it already here:
(Status-Line):HTTP/1.1 200 OK
Server:Microsof t-IIS/5.1
Date:Fri, 29 Sep 2006 14:53:49 GMT
X-Powered-By:ASP.NET
Connection:clos e
X-AspNet-Version:2.0.507 27
ABB:MES
Set-Cookie:ASP.NET_ SessionId=kfrv5 c55kbeefemshid2 ki45; path=/; HttpOnly
Cache-Control:no-cache
<------------------------------------------------------
Pragma:no-cache
<---------------------------------------------------------------
Expires:-1
Content-Type:text/html; charset=utf-8
Content-Length:239
Cache-Control: no-cache
Pragma: no-cache
Is't it already here:
(Status-Line):HTTP/1.1 200 OK
Server:Microsof t-IIS/5.1
<snip>
Firefox has POST problems with some versions of IIS, because some IIS
are using a non-standard packets split-off in response (if not
patched). IE likes it, Firefox wants it in the conventional way. Search
bugzilla.mozill a.org for "IIS server POST packet length", I don't have
the exact bug URL. I'm not saying it is the reason: just one more
direction to look at. Maybe c.i.w.a.h. and mozilla.org can be more
helpful.
VK wrote:
Cache-Control: no-cache
Pragma: no-cache
Is't it already here:
(Status-Line):HTTP/1.1 200 OK
Server:Microsof t-IIS/5.1
<snip>
Firefox has POST problems with some versions of IIS, because some IIS
are using a non-standard packets split-off in response (if not
patched). IE likes it, Firefox wants it in the conventional way. Search
bugzilla.mozill a.org for "IIS server POST packet length", I don't have
the exact bug URL. I'm not saying it is the reason: just one more
direction to look at. Maybe c.i.w.a.h. and mozilla.org can be more
helpful.
Thanks VK, I will try searching for it at mozilla.org.
However I got the same problem with IE !
OK, Ajax IS now reported fit :)
I tested it a little more and added a alert in my function:
function AjaxFormPostIta lertContents()
{
if(AjaxForm.rea dyState == 4)
{
if (AjaxForm.statu s == 200)
{
var result = AjaxFormPostItH TTPRequest.resp onseText;
alert(result);
document.getEle mentById('PostI nformationWindo w').innerHTML =
result;
}
else
{
alert('There was a problem with the request.');
}
}
}
In the alert window I did see that the values from the server was
changed,
but NOT in the 'PostInformatio nWindow' <div>
How come ?
GTi wrote:
I have a bizare Ajax POST problem.
I use Ajax POST to send data to the server.
The server get the POST and answer back.
BUT if I POST the data once again I recieve the same answer that the
first post give me, even if the answer is different. I have used HTTP
Analyser Std V2.1.1.15 and I see that the answer is different. But the
Ajax .responseText is the same as the first POST. It looks like it use
the cached respons.
In the RFC the client should never use the cache if it is a POST.
And to make sure I have added a new serial=xxxx in the POST URL for
eatch requests.
But still get the same result as the first POST into the JavaScript
(but the respons from the server IS different).
Here is the server responses from HTTP Analyser:
----------------------------------------
(Request-Line):POST /page.aspx?EditM aster=0&serial= 1159541629765
HTTP/1.1
Host:127.0.0.1
User-Agent:Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.7)
Gecko/20060909 Firefox/1.5.0.7
Accept:text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,ima ge/png,*/*;q=0.5
Accept-Language:nb
Accept-Encoding:gzip,d eflate
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive:300
Connection:clos e
Content-Type:applicatio n/x-www-form-urlencoded
Cache-Control:post-check=0, pre-check=0, no-cache
Pragma:no-cache, no-cache
Content-Length:3695
Cookie:WebSelec tTabWorkShiftWe bTab2=1; WebSelectTabRea lTPIWebTab2=2
-----------------------------------------
(Status-Line):HTTP/1.1 200 OK
Server:Microsof t-IIS/5.1
Date:Fri, 29 Sep 2006 14:53:49 GMT
X-Powered-By:ASP.NET
Connection:clos e
X-AspNet-Version:2.0.507 27
ABB:MES
Set-Cookie:ASP.NET_ SessionId=kfrv5 c55kbeefemshid2 ki45; path=/; HttpOnly
Cache-Control:no-cache
Pragma:no-cache
Expires:-1
Content-Type:text/html; charset=utf-8
Content-Length:239
Here is the JavaScript Code:
function AjaxFormPostItM akeRequest(url, data)
{
[snippet .. AjaxForm = new XMLHttpRequest( ) ... blabla]
AjaxForm.onread ystatechange = AjaxFormPostIta lertContents;
AjaxForm.open(' POST', url, true);
AjaxForm.setReq uestHeader("Con tent-Type",
"applicatio n/x-www-form-urlencoded");
AjaxForm.setReq uestHeader("Con tent-length", data.length);
AjaxForm.setReq uestHeader("Con nection", "close");
AjaxForm.setReq uestHeader("Cac he-Control", "no-store, no-cache,
must-revalidate");
AjaxForm.setReq uestHeader("Cac he-Control", "post-check=0,
pre-check=0");
AjaxForm.setReq uestHeader("Pra gma", "no-cache");
AjaxForm.send(d ata);
}
function AjaxFormPostIt( obj)
{
var getstr = '';
[ snippet - get all the post elements]
var timestamp = new Date().getTime( );
var url = '/page.aspx?EditM aster=0&serial= ' + timestamp;
AjaxFormPostItM akeRequest(url, getstr);
}
Anyone can help me out here - please?
GTi
GTi wrote:
In the alert window I did see that the values from the server was
changed,
but NOT in the 'PostInformatio nWindow' <div>
How come ?
Nasty gobblins in your computer? :-)
That must be some communication problem with 'PostInformatio nWindow',
without an actual page it's difficult to say. From the most recent
"misteries" of this kind: are you using full-qualified page with
<html>, <headand <body: or a "lazy version" with body elements
only? (Firefox spits on the last one).
VK wrote:
GTi wrote:
In the alert window I did see that the values from the server was
changed,
but NOT in the 'PostInformatio nWindow' <div>
How come ?
Nasty gobblins in your computer? :-)
That must be some communication problem with 'PostInformatio nWindow',
without an actual page it's difficult to say. From the most recent
"misteries" of this kind: are you using full-qualified page with
<html>, <headand <body: or a "lazy version" with body elements
only? (Firefox spits on the last one).
LOL
The whole page is rater big but it is html verified with FireFox.
I guess it is something in my code somwhere.
Topic locked. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Yarco |
last post by:
I want to use "Ajax" to create my web for hobby.
But i don't know whether "Ajax" is mature...
And what about with php? Someone have experience on it?
....
|
by: bobzimuta |
last post by:
I'm creating a simple AJAX library. It's an object that will return an
array containing the response text or xml. I'm trying to find a way to
assign the response as a property of the object, but from within an
inline function.
Within the AJAX object:
this.xmlhttp = new XMLHttpRequest();
this.response = ''; //to contain the response text OR xml
var that = this; //since we cannot reference this within the
|
by: melledge |
last post by:
Ajax Developers' Day added to XTech 2006 agenda
XTech 2006 - 17-19 May - Hotel Grand Krasnopolsky - Amsterdam, The
Netherlands
|
by: melledge |
last post by:
Ajax Developers' Day to Kick Off XTech 2006 Conference
Industry experts offer insight into next generation of the Web
ALEXANDRIA, VIRGINIA, USA - April 25, 2006 - In response to the
rapidly developing world of Ajax user interfaces on the browser,
IDEAlliance (www.idealliance.org) announced today that its annual XTech
Conference will kick off on May 16 with Ajax Developers' Day. XTech
2006 (www.xtech-conference.org), to be held May...
|
by: Curt |
last post by:
Thank God for backups. This is the 3rd time this kind of crap pops up. I
have not been in the module these errors reference in a month. But now
my app will not build because of this crap. Any assistance would be most
appreciated. To Date, this kind of stuf has cost me about 2-3 days work.
| |
by: www.web20developers.com |
last post by:
http://www.web20developers.com
http://www.web20developers.com/index.php?option=com_content&task=view...
Ajallerix : AJAX, simple, fast Web image gallery demo ; at Novell
AJAX - microlink pattern tutorial : A microlink is a link that opens up
|
by: =?Utf-8?B?WWFua2VlIEltcGVyaWFsaXN0IERvZw==?= |
last post by:
controlsPlease could some of you here post some of your live examples of AJAX
(esp drag panels, collapsable panels, and popup menu.)
(It's one thing to talk about how great something is, but it's another to
really see how great something is.)
Thanks
--
Share The Knowledge. I need all the help I can get and so do you!
|
by: soni2926 |
last post by:
hi,
does anyone know of any good books on ajax and asp.net, one that
teaches ajax itself before jumping in atlas? I wanted to get an
understanding of ajax and how to use it, most books i've seen on .net
and ajax seem to jump into atlas right away, does anyone know of any
that teach ajax itself and then later get into atlas?
|
by: shaunwo |
last post by:
I'm an AJAX / DOM Novice (at best) and trying to figure out how to write the value to a couple input fields. I don't remember exactly where I got the ajax.js file I'm using from (went to the website that I see in the comments, but no luck there), but what I already have works GREAT to populate the options in a select box. Now I'm trying to take that same code and get it to write the value to a couple input boxes.
Here's a link to my ajax...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |