Created
August 22, 2014 01:09
-
-
Save YutaWatanabe/f4213027033418a409e7 to your computer and use it in GitHub Desktop.
Delete the item in Azure Mobile Service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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" | |
}); | |
}); | |
*/ | |
// Item テーブルの項目を読出し | |
// 読出されたアイテムの内先頭のものを削除 | |
itemTable.read().done(function(items){ | |
// 先頭の項目の id を指定して削除します | |
itemTable.del({ | |
id: items[0].id | |
}); | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment