AJAX

3 views
Skip to first unread message

Raj....

unread,
Oct 14, 2005, 12:35:08 AM10/14/05
to .NetIndia
hi guys...

Anybody knows the very gud technology which every web developers
should know... that is AJAX.... its really beautiful.. its gud to
discuss abt it and also about shadow copy... its really core... till
now i couldn't succeed in that.... trying a lot.... if anyone knows
better do respond...

and please dont give me links... cause i searched through the web for
more than 1 week... i have seen all the links... so please give me
solution directly...


Thank you...
Raj....

BabuLives

unread,
Oct 14, 2005, 2:36:17 AM10/14/05
to .NetIndia
AJAX- Asynchronous Javascript and XML.

Its a very good technology to get data from server without having the
page refreshed.It is achieved by xmlhttpRequest object which work
similar to javascript image object where we can change the image
dynamically without refreshing the page..

Just add reference to the AJAX Dll to your project...

Open the Web.Config file add the ajax handler factory..so that if any
requesr for ajax/*.ashx) is met by server ti will use
Ajax.PageHandlerFactory for handling the request...

so add the folow code in web.config


<configuration>
<system.web>
<httpHandlers>
<add verb="POST,GET" path="ajax/*.ashx"
type="Ajax.PageHandlerFactory, Ajax" />
</httpHandlers>
<system.web>
</configuration>

Now add the server side function in webform say getname()


[Ajax.AjaxMethod]
public static string GetName()
{
return "Satheesh babu";
}


Add the attribute [Ajax.AjaxMethod] before all the method that is
called from jscript..

Now Go to the page load..
type..
Ajax.Utility.RegisterTypeForAjax(GetType(WebForm1));


The call to RegisterTypeForAjax emits the following JavaScript on the
page or u can copy this code on ur page..where Sample is the namespace
name,

<script language="javascript" src="ajax/common.ashx"></script>
<script language="javascript"
src="ajax/Sample.WebForm1,Sample.ashx"></script>

Now Add a html Button to the page...

Add a javascript function ...

<script language="javascript">
function fn()
{
var n=WebForm1.GetName();
alert(n.value);
}

</script>


<INPUT onclick="fn()"t ype="button" value="Button">

Now compile and run the page...


This is a simple example to use AJAX in our project..Like this we can
return complex type also from server..

U can download the AJAX dll form Michael Schwarz blog..

http://weblogs.asp.net/mschwarz/

Actually the Ajax Wrapper creates a javascript fuction Sample.Getname()
,So that Client function can able to communicate with the server
functions...


Regards,
Satheesh

Raja Prakash

unread,
Oct 14, 2005, 3:01:52 AM10/14/05
to Techdot...@googlegroups.com
Satheesh....
 
 
    why you need dll.... you can make it very simple using only javascript xmlhttprequest object....  search for it and post the document....
 
okay
 
 
byeee....
raj....

 

satheesh babu b

unread,
Oct 14, 2005, 6:56:15 AM10/14/05
to Techdot...@googlegroups.com
hey..
 yes we can do without this dll also...
 
see this project u can understand it clearly...here i am calling a simple server side functions using xmlhttprequest object..keep the project name as ajaxsample...
 
Regards,
Satheesh
ajaxforms.zip
Reply all
Reply to author
Forward
0 new messages