addshelf.js 643 B

1234567891011121314151617181920
  1. $(function () {
  2. $('.js_add_shelf').click(function () {
  3. $.ajax({
  4. type: 'POST',
  5. url: '/api/bookshelf/insert',
  6. data: {book_id: book_id_shelf},
  7. success:function(data) {
  8. if (data.code) {
  9. $(this).text('已加入书架');
  10. $(this).removeClass('js_add_shelf');
  11. $(this).addClass('js_add_shelfed');
  12. consoleMain('加入书架成功');
  13. }
  14. }.bind(this),
  15. error:function(err) {
  16. consoleMain('加入书架失败');
  17. }
  18. })
  19. });
  20. })