Error message

You are browsing documentation for drupal 7.x, which is not supported anymore. Read the updated version of this page for drupal 11.x (the latest version).

function ajax_command_alert

Creates a Drupal Ajax 'alert' command.

The 'alert' command instructs the client to display a JavaScript alert dialog box.

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

Parameters

$text: The message string to display to the user.

Return value

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

Related topics

Ajax framework commands
Functions to create various Ajax commands.
2 calls to ajax_command_alert()
ajax_forms_test_advanced_commands_alert_callback in modules/simpletest/tests/ajax_forms_test.module
Ajax callback for 'alert'.
ajax_prepare_response in includes/ajax.inc
Converts the return value of a page callback into an Ajax commands array.

File

includes/ajax.inc, line 840

Code

function ajax_command_alert ($text) {
 return array(
 'command' => 'alert',
 'text' => $text,
 );
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.