You are here

function js_callback_examples_js_callback_get_uid in JS Callback Handler 7.2

Implements MODULE_js_callback_CALLBACK().

File

js_callback_examples/js_callback_examples.module, line 143
Provides examples on how to use the JS module API.

Code

function js_callback_examples_js_callback_get_uid($first_name) {
  $json = array();

  // Ensure that the $first_name variable was provided.
  if (empty($first_name)) {
    drupal_set_message(t('You must enter your first name.'), 'error');
    $json['content'] = '<p>I don\'t know who you are!</p>';
  }
  else {
    $json['content'] = "<p>Hi {$first_name}!</p>";
  }
  return $json;
}