install.js 999 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. $(function() {
  2. $('.list-group-item.active').prevAll().addClass("done");
  3. var prevUrl = $('.list-group-item.active').prev().data("url");
  4. var nextUrl = $('.list-group-item.active').next().data("url");
  5. var activeUrl = $('.list-group-item.active').data("url");
  6. if (prevUrl == undefined) {
  7. $("#prevButton").addClass("hidden");
  8. } else {
  9. $("#prevButton").click(function() {
  10. location.href = prevUrl;
  11. });
  12. }
  13. if (nextUrl == undefined) {
  14. $("#nextButton").text("完成");
  15. nextUrl="./admin"
  16. }
  17. $("#nextButton").click(function() {
  18. $('#target').loadingOverlay();
  19. if ($(".install-form").length == 0) {
  20. location.href = nextUrl;
  21. return;
  22. }
  23. $.ajax({
  24. type : "POST",
  25. url : activeUrl,
  26. data : $("form.install-form").serializeArray(),
  27. success : function(res) {
  28. $('#target').loadingOverlay('remove');
  29. if (res.status == true) {
  30. if (nextUrl) {
  31. location.href = nextUrl;
  32. }
  33. } else {
  34. alert(res.message.split("=_=")[0]);
  35. }
  36. }
  37. });
  38. });
  39. });