|
-
May 19th, 2008, 01:12 PM
#1
Re: [2005] refresh asp component only, not the whole page...
 Originally Posted by MonkOFox
What I'm really wanting to know is, can I use AJAX in a web application without using the ASP.NET AJAX tools and extensions?
Like incoporating this basic AJAX structure into a web app.
HTML Code:
<script type = "text/javascript">
var xmlHttp;
function emailTo(user,useremail,usersubject,usermessage)
{
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
{
alert ("Your browser does not support AJAX!");
return;
}
var url="default.aspx";
url=url+"?name="+user+"&useremail="+useremail+"&subject="+usersubject+"&Umessage="+usermessage;
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
function stateChanged()
{
if (xmlHttp.readyState==4)
{
alert(xmlHttp.responseText);
}
}
function GetXmlHttpObject()
{
var xmlHttp=null;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
</script>
Thanks,
Justin Fox
To answer that specific question, yes, of course you can. ASP.NET AJAX is just a framework written over the kinds of things you're doing. Just put it into your <script> tag at the top of the page.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|