jquery.jsonengine.js æ¸ãå§ãã
jsonengineãã·ã³ãã«ã«æ±ããã¨ã®åºæ¥ãjQueryãã©ã°ã¤ã³ãæ¸ãããã ãã©å ¬éãããã¯ã¾ã è¿·ãä¸ããã³ã®ã¡ãã£ã¨ã ã便å©ããªã¼ã¨ããããªæãã§æ¸ãã¾ãã
jquery.jsonengine.js ã®ãµã³ãã«
$(function() { //ã¹ã¿ã¤ã«1ï¼ããã©ã«ãã®docTypeãæå®ããã©ã¡ã¼ã¿ããªãã¸ã§ã¯ããªãã©ã«ã§æ¸¡ããupdateã¯å¿ ã_checkUpdatesAfterãä»ãã $.je.docType('tasks'); $.je.create({"foo":"bar"}, function(response, status){ // do something with task here }); $.je.read({"foo":".eq.bar"}, function(response, status){ // do something with task here }); $.je.update({"foo":"bar","_docId":"00roxf3RwEBi1ZobhYECZdUnT766oU97"}, function(response, status){ // do something with task here }); $.je.destroy({"_docId":"00roxf3RwEBi1ZobhYECZdUnT766oU97"}, function(response, status){ // do something with task here }); //ã¹ã¿ã¤ã«2ï¼å®è¡æ¯ã«docTypeãæå®ããã©ã¡ã¼ã¿ããªãã¸ã§ã¯ããªãã©ã«ã§æ¸¡ã $.je.post('tasks', {"foo":"bar"}, function(response, status){}, function(xhr, status, errorThrown){}); $.je.get('tasks', {"foo":".eq.bar"}, function(response, status){}, function(xhr, status, errorThrown){}); $.je.put('tasks', {"foo":"bar","_docId":"00roxf3RwEBi1ZobhYECZdUnT766oU97"}, function(response, status){}, function(xhr, status, errorThrown){}); $.je.del('tasks', {"_docId":"00roxf3RwEBi1ZobhYECZdUnT766oU97"}, function(response, status){}, function(xhr, status, errorThrown){}); //ã¹ã¿ã¤ã«3:ãã©ã¡ã¼ã¿ãå ¨ã¦æååã§å®ç¾©ãã¦å®è¡ãã $.je.put('/tasks?foo=bar', function(response, status){}, function(xhr, status, errorThrown){}); $.je.get('/tasks/00roxf3RwEBi1ZobhYECZdUnT766oU97', function(response, status){}, function(xhr, status, errorThrown){}); $.je.get('/tasks?cond=foo.eq.bar', function(response, status){}, function(xhr, status, errorThrown){}); $.je.put('/tasks?foo=bar?_docId=00roxf3RwEBi1ZobhYECZdUnT766oU97', function(response, status){}, function(xhr, status, errorThrown){}); $.je.del('/tasks/00roxf3RwEBi1ZobhYECZdUnT766oU97', function(response, status){}, function(xhr, status, errorThrown){}); });
æåã¯slim3ã®DataStoreã£ã½ããã§ã¼ã³ã¡ã½ããã§çµã¿ç«ã¦ãå½¢å¼ã§æ¸ãããã©IDEããã®æ¯æ´æ©è½ã使ããªãã¦ããã¾ãæå³ãªãããªã£ã¦ãã£ã¡ã®æ¸ãæ¹ã«ç´ããããããªãjQueryç¥ã£ã¦ã人ã ã¨ä¸ç®ã§ä½¿ãæ¹ãåãã£ã¦ããããããããªããã¨ããã£ã¨æ±ç¨çãªRESTFullãã©ã°ã¤ã³ãããããªï¼ãæè¦ãèãããã ããã