ASP.net Joyrock asynchronous application example, JSON-RPC usage, joyrockjson-rpc
To use Joyrock, you must first reference the Jayrock. dll and Jayrock. Json. dll files, and introduce the json. js files on the web page (json. js files downloaded from different places cannot be used ),
. Net Background File
Using System; using System. collections. generic; using System. linq; using System. web; using Jayrock. json; using Jayrock. jsonRpc; using Jayrock. jsonRpc. web; namespace Exam. jayrock {public class Handler1: jsonRpcHandler {// <summary> /// without parameters /// </summary> /// <returns> </returns> [JsonRpcMethod ("getstring1")] public string getstring1 () {return String. format ("Welcome to Jayrock by {0 }! ", DateTime. now);} // <summary> // with parameters /// </summary> /// <param Name = "str"> The string. </param> // <returns> </returns> [JsonRpcMethod ("getstring2")] public string getstring2 (string str) {return String. format ("Welcome to Jayrock by {0 }! ", Str);} [JsonRpcMethod (" addEntity ")] public int addEntity (JsonObject ent) {new Entity (" demo "). addEntity (ent); return 1;} [JsonRpcMethod ("updateEntity")] public int updateEntity (JsonObject ent) {new Entity ("demo "). updateEntity (ent); return 1;} [JsonRpcMethod ("delEntity")] public int delEntity (int id) {new Entity ("demo "). delEntity (id); return 1;} [JsonRpcMethod ("getEntityList")] public List <JsonObject> getEntityList (string where) {return new Entity ("demo "). getEntityList (where );}}}
Frontend call page
<Html xmlns = "http://www.w3.org/1999/xhtml">