<script>
function send()
{
$.getJSON('send.ashx?type=login', function (data)
{
if (data.login== "1")
alert('登录成功')
else
alert('登录失败')
}}
)}
</script>
public class AjaxHandle : IHttpHandler
{
HttpContext context = null
HttpRequest request = null
HttpResponse response = null
public void ProcessRequest(HttpContext contexts)
{
context = contexts
request = contexts.Request
response = contexts.Response
result = request["type"]
string msg = "{\"login\":\"1\"}"
response.Write(msg)
}
}
发请求过去撒 一般都用在ajax 上 用 jquery给你举个例子$(document).ready(function () {
$.ajax({
type: "GET",
url: "Report/maincofhandler.ashx",
data: qsdata,
dataType: "json",
cache: false,
success: (function (data) {
//data 就是请求的响应值
})//success END
})// AJAX END
}) //ready END
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)