jquery Tuning Method:<script type= "Text/javascript" > $(function() {$.get ("/ashx/gettraceabilityjson.ashx?" +NewDate (), {' ProductCode ': ' <%=productcode%> ', ' batchnumber ': ' <%=batchnumber%> ', ' command ': ' Getflowgraph ' },function(data) {if(Data! =NULL) { vardata =$.parsejson (decodeuricomponent (data)); varnodes = eval (data[0].value); varLinks = eval (data[1].value); if(Nodes.length > 0) {setnodes (nodes); Setlinks (links); } } }); }); </script>
The general processing procedure backstage writes the method;
/// <summary> ///Summary description of Gettraceabilityjson/// </summary> Public classGettraceabilityjson:ihttphandler { Public voidProcessRequest (HttpContext context) {context. Response.ContentType="Text/plain"; if(Context. request["Command"] !=NULL) { stringCommand = context. request["Command"]; System.Reflection.MethodInfo Method=GetType (). GetMethod (command); if(Method! =NULL) {method. Invoke ( This,New Object[] {context}); } } } Public BOOLisreusable {Get { return false; } } Public voidGetflowgraph (HttpContext context) {stringProductCode = parameterfilter.getstring (context. request.querystring["ProductCode"]); stringBatchNumber = parameterfilter.getstring (context. request.querystring["BatchNumber"]); if(string. IsNullOrEmpty (BatchNumber)) {return; } //string a = "[{\" name\ ": \" node\ ", \" value\ ": \" [{' id ': ' 0 ', ' name ': ' Production of inbound orders: SC20131217000116 ', ' statue ': ' Oval '},{' id ': ' 1 ', ' name ': ' Sales out of stock list: XS20131217000116 ', ' statue ': ' Normal '},{' id ': ' 5 ', ' Name ': ' Sales out of stock list: XS20131217000116 ', ' statue ': ' normal '},{' id ': ' 6 ', ' Name ': ' Sales out of stock list: XS20131217000116 ', ' statue ': ' Normal '} , {' id ': ' 7 ', ' Name ': ' Sales out of stock list: XS20131217000116 ', ' statue ': ' Normal '},{' id ': ' 2 ', ' name ': ' Sales out of stock list: XS20131218000120 ', ' Statue ': ' normal '},{' id ': ' 3 ', ' Name ': ' Purchase inbound order: CG20131218000025 ', ' statue ': ' normal '},{' id ': ' 4 ', ' Name ': ' Sales out of stock list: XS20131218000121 ', ' statue ': ' Normal '}]\ "},{\" name\ ": \" Link\ ", \" value\ ": \" [{' Name ': ' ", ' target ': ' 1 ', ' source ': ' 0 '} {' name ': ', ' target ': ' 2 ', ' source ': ' 0 '},{' name ': ', ' ' Target ': ' 3 ', ' Source ': ' 2 '},{' name ': ', ' target ': ' 4 ', ' source ': ' 3 '},{' name ': ', ' ' Target ': ' 5 ', ' source ': ' 0 '},{' name ': ', ' target ': ' 6 ', ' source ': ' 0 '},{' name ': ', ' target ': ' 7 ', ' SOURCE ': ' 0 '}]\ "}]"; JavaScriptSerializer JSS=NewJavaScriptSerializer (); Node[] Values=Newnode[] {NewNode () {name ="node", value = ("["+ sbnodes.tostring (). TrimEnd (',') +"]") }, NewNode () {name ="Link", value = ("["+ sbnodelinks.tostring (). TrimEnd (',') +"]") } }; Context. Response.ContentType="Text/plain"; stringJSON =JSS. Serialize (values); Context. Response.Write (JSON); Context. Response.End (); }
jquery calls multiple methods of a generic handler