• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 276
  • Last Modified:

the response of Ajax is not updated

I am developing a Asp.net Application using Ajax..
here i call tha Ajax:  url = "http://localhost:49674/test/LastPosition.aspx?name=test&userid=1"       
and my response will be like this:
<?xml version="1.0" encoding="UTF-8" ?>
- <NewDataSet>
- <Table>

but the problem is: if i launch 'http://localhost:49674/test/LastPosition.aspx?name=test&userid=1' in internet explorer  I get the last record inserted in database

but in javascript code when i receeive the ajax response i still get the old record..
please help
 there is my LastPosition.aspx code:
protected void Page_Load(object sender, EventArgs e)
       name = Request.QueryString["name"];
       userid = Convert.ToInt16(Request.QueryString["userid"]);
       ds = this.busLayertracking.GetDeviceLastPosition(userid, name);
       XmlDocument doc = new XmlDocument();       
       XmlDeclaration xmldecl;
       xmldecl = doc.CreateXmlDeclaration("1.0", "UTF-8", null);
       XmlElement root = doc.DocumentElement;
       doc.InsertBefore(xmldecl, root);
       Response.ContentType = "text/xml";

Open in new window

1 Solution
David S.Commented:
It sounds like you've run into IE's tendency to cache AJAX responses.

One solution would be to add a pseudo-random string to the end of each URL:

url = 'http://localhost:49674/test/LastPosition.aspx?name=test&userid=1&'+(new Date()).getTime();

More information (be sure to read the first comment): http://weblogs.asp.net/pleloup/archive/2006/06/08/451583.aspx
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now