Skip to content

Instantly share code, notes, and snippets.

@YutaWatanabe
Created August 22, 2014 01:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save YutaWatanabe/c2e89fc124b14195e79a to your computer and use it in GitHub Desktop.
Save YutaWatanabe/c2e89fc124b14195e79a to your computer and use it in GitHub Desktop.
Update the created item in Azure Mobile Service
(function(){
// MobileServiceClient のインスタンスを作成
// URL, KEY は管理画面に表示されているものを貼り付け
var client = new WindowsAzure.MobileServiceClient(
"URL",
"KEY"
);
// Item テーブルのインスタンス取得
var itemTable = client.getTable("Item");
// Item テーブルに項目追加
itemTable.insert({ text:"Sample Item"})
.then(function(item){
//新しく追加した項目の id を取得
var itemId = item.id;
// id が itemId な項目の text を "Updated Item" に変更
itemTable.update({
id: itemId,
text: "Updated Item"
});
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment