<input id="Button1" type="button" value="button" onclick="return Button1_onclick()" /> <asp:textbox id="TextBox1" runat="server" xmlns:asp="#unknown" /> <script type="text/javascript"> function createXMLHttpRequest() { try { return new XMLHttpRequest(); } catch (e) { } try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { } try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { } alert("XMLHttpRequest not supported"); return null; } function Button1_onclick() { var xmlHttpReq = createXMLHttpRequest(); xmlHttpReq.open("GET", "Handler1.ashx?Value=" + document.getElementById('TextBox1').value, false); xmlHttpReq.send(null); var yourJSString = xmlHttpReq.responseText; alert(yourJSString); } </script>
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string Value = context.Request.QueryString["Value"].ToString(); if (Value == "1234") { context.Response.Output.Write("True"); } else { context.Response.Output.Write("False"); } } public bool IsReusable { get { return false; } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)