install.js 809 B

123456789101112131415161718192021222324252627282930
  1. (function($,History){
  2. var State = History.getState();
  3. $(document).ready(function(){
  4. if($.isEmptyObject(State.data)){
  5. History.replaceState({
  6. type: 'install',
  7. id: 'config'
  8. },'Bugs');
  9. }
  10. $(window).on('statechange',function(){
  11. State = History.getState();
  12. $.get('api.php',State.data,function(d){
  13. $('body').html(d);
  14. $('#config').submit(function(){
  15. $('#install').attr('disabled','disabled');
  16. $.get('api.php?'+$("#config").serialize()+'&dbtemplate=install&type=install&id=run',function(d){
  17. if(d != "pass"){
  18. alert(d);
  19. $('#install').removeAttr('disabled');
  20. }else{
  21. alert('Installation successful!');
  22. location = '..';
  23. }
  24. },'text');
  25. return false;
  26. });
  27. },'html');
  28. }).trigger('statechange');
  29. });
  30. })(jQuery,History);