Created
September 13, 2014 19:58
-
-
Save yannickoo/202a402fb205062993c0 to your computer and use it in GitHub Desktop.
Putting a Drupal website into maintenance mode via JS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery.get(Drupal.settings.basePath + 'admin/config/development/maintenance', function (data, status) { | |
if (status == 'success') { | |
var token = jQuery(data).find('[name="form_token"]').val(); | |
var build = jQuery(data).find('[name="form_build_id"]').val(); | |
var payload = { | |
'form_id': 'system_site_maintenance_mode', | |
'form_token': token, | |
'form_build_id': build, | |
'maintenance_mode': 0 | |
}; | |
jQuery.post(Drupal.settings.basePath + 'admin/config/development/maintenance', payload); | |
} | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment