<script type="text/javascript">
function getData_ashx() {
var response
= '';
$.ajax({
type: "GET",
url: "/class/ashx/GraphHandler.ashx",
async: false,
success:
function (text) {
response = text;
}
});
alert(response);
return response;
}
</script>
********* GraphHandler.ashx **********************
Imports System.Web
Imports System.Web.Services
Public Class GraphHandler
Implements System.Web.IHttpHandler
Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
context.Response.ContentType = "text/plain"
context.Response.Write(getdata_Chart())
End Sub
Public Shared Function getdata_Chart() As String
Dim str As New StringBuilder
str.Append("{ y: '2006', a: 50, b: 90, c: 112 },")
str.Append("{ y: '2007', a: 75, b: 65, c: 95 },")
str.Append("{ y: '2008', a: 50, b: 40, c: 80 },")
str.Append("{ y: '2009', a: 75, b: 65, c: 96 },")
str.Append("{ y: '2010', a: 50, b: 40, c: 75 },")
str.Append("{ y: '2011', a: 75, b: 65, c: 110 },")
str.Append("{ y: '2012', a: 100, b: 90, c: 132 },")
str.Append("{ y: '2013', a: 125, b: 110, c: 152 },")
str.Append("{ y: '2014', a: 145, b: 135, c: 165 }")
Return str.ToString
End Function
ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
Get
Return False
End Get
End Property
End Class
ไม่มีความคิดเห็น:
แสดงความคิดเห็น