Simple AJAX Question

Fork501

Freshman
Joined
Jan 27, 2007
Messages
41
Location
Weston, Florida
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!
 
Quick Update:

It allows me to use the page if I put the following code on the page:

Code:
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!
 
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
 
Back
Top