- 履歴一覧
- 差分 を表示
- 現在との差分 を表示
- ソース を表示
- Parse/オブジェクトを保存する へ行く。
書き途中ですー。
var post = function(title, body) {
// クラス
var Post = Parse.Object.extend('Post');
// インスタンス
var post = new Post();
// 属性
post.set('title', title);
post.set('body', body);
// 保存
post.save(null, {
success: function(post) {
jQuery('#message').text('新しいポスト: ' + post.id);
},
error: function(post, error) {
jQuery('#message').text('ERROR: ' + error.description);
}
});
};
jQuery('input[name=object-save-post]').click(function() {
var title = jQuery('input[name=object-save-title]').val();
var body = jQuery('textarea[name=object-save-body]').val();
if (title.length > 0 && body.length > 0) {
post(title, body);
} else {
jQuery('#message').text('WARN: ' + 'titleとbodyを入力してからpostしてね。');
}
});