main.js 855 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. function Proxy() {
  2. }
  3. Proxy.prototype.root = function () {
  4. return www + '/main/inc/ajax/course_description.ajax.php';
  5. }
  6. Proxy.prototype.post = function (data, f) {
  7. if (typeof(sec_token) !== 'undefined') {
  8. data.sec_token = sec_token;
  9. }
  10. $.post(this.root(), data, f, 'json');
  11. }
  12. var CourseDescription = new Proxy();
  13. CourseDescription.del = function (c_id, id, f) {
  14. var data = {
  15. c_id: c_id,
  16. id: id,
  17. action: 'delete'
  18. };
  19. this.post(data, f);
  20. };
  21. CourseDescription.delete_by_course = function (c_id, session_id, f) {
  22. var data = {
  23. c_id: c_id,
  24. session_id: session_id,
  25. action: 'delete_by_course'
  26. };
  27. this.post(data, f);
  28. };
  29. var message = {};
  30. message.update = function (data) {
  31. text = typeof(data) == 'string' ? data : data.message;
  32. $('#messages').html(text);
  33. }