Fork501 Posted April 9, 2007 Posted April 9, 2007 I am just trying out AJAX and am having a slight problem. Right now, my VS 2003 and VS 2005 @ work are on the fritz, so I can't even pop my page into it to try to see if I can get an answer. Anyways, my question: When I do a simple Response.Write in my aspx form to return to my JavaScript, it works fine. I'm just making it return the current time. It doesn't refresh the time, which is fine, because I know how to fix it. The problem is the fix is what kills me! When I put Response.Expires=-1 or Response.Expires=0 or anything OTHER THAN Response.Write in my code, my code no longer returns anything. I am using .NET Framework 2.0 to program with. Any and all help will be GREATLY appreciated! Quote Check out my blog! DevPaper.NET
Fork501 Posted April 9, 2007 Author Posted April 9, 2007 Quick Update: It allows me to use the page if I put the following code on the page: Response.Cache.SetExpires(DateTime.Now.AddSeconds(1)); The problem is that (for example) a time update lets you see every OTHER second. Thanks once again in advance! ~Derek Edit: Also, it doesn't work with the DateTime.Now.AddMillisecond() property. Thanks again! Quote Check out my blog! DevPaper.NET
Fork501 Posted April 10, 2007 Author Posted April 10, 2007 Got it! My findings: The proper way to assign a returned-value from an ASP page is to set the returned value to a variable. Send that variable to another function and assign it to the textbox/div/whatever else you want to. My problem was that I was trying to set a value to a div outside of the enclosed if statement, which checked to make sure there was data in it. Thanks anyways! ~Derek Quote Check out my blog! DevPaper.NET
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.