function ajax_command_add_css

Creates a Drupal Ajax 'add_css' command.

This method will add css via ajax in a cross-browser compatible way.

This command is implemented by Drupal.ajax.prototype.commands.add_css() defined in misc/ajax.js.


$styles: A string that contains the styles to be added.

Return value

An array suitable for use with the ajax_render() function.

See also


Related topics

2 calls to ajax_command_add_css()
ajax_forms_test_advanced_commands_add_css_callback in drupal/core/modules/system/tests/modules/ajax_forms_test/ajax_forms_test.module
Ajax callback for 'add_css'.
ajax_render in drupal/core/includes/
Renders a commands array into JSON.


drupal/core/includes/, line 1154
Functions for use with Drupal's Ajax framework.


function ajax_command_add_css($styles) {
  return array(
    'command' => 'add_css',
    'data' => $styles,