<html>
<head>
<title>Hello Ajax version 1</title>
<style type='text/css'>
* { font-family: Tahoma, Arial, sans-serif; }
#helloTitle{ color: #48f; font-size: 1.5em; }
</style>
<script type='text/javascript' src='prototype.js'> </script>
<script type='text/javascript'>
window.onload=function() {
document.getElementById('helloBtn').onclick = function(){
var name = document.getElementById('helloTxt').value;
new Ajax.Request(
"hello1.jsp?name = "+encodeURI(name),
{
method:"get",
onComplete:function(xhr){
document.getElementById('helloTitle').innerHTML = xhr.responseText;
}
}
);
};
};
</script>
</head>
<body>
<h1 id='helloTitle'>Hello, stranger</h1>
<p>Please introduce yourself by entering your name in the box below</p>
<input type='text' size='24' id='helloTxt'>
</input>
<button id='helloBtn'>Submit</button>
</body>
</html>
//hello1.jsp
<jsp:directive.page contentType="text/plain"/>
<%
String name = request.getParameter("name");
%>
Hello, <%=name%>
This is code is in JSP .... where the user enters his name in the text box and the word 'stranger' is just replaced by that name ... like :- Hello, <name> ....
How will do the same thing in ASP.Net ??
Please help !!!