You are here

function kwresearch_delete_site_keyword_js in Keyword Research 7

Same name and namespace in other branches
  1. 6 kwresearch.module \kwresearch_delete_site_keyword_js()

AJAX handler to delete a site keyword from db

1 string reference to 'kwresearch_delete_site_keyword_js'
kwresearch_menu in ./kwresearch.module
Implements hook_menu()

File

./kwresearch.module, line 941

Code

function kwresearch_delete_site_keyword_js() {

  // check if valid request containing Drupal generated token
  if (empty($_POST['token']) || !drupal_valid_token($_POST['token'], 'kwresearch')) {
    drupal_access_denied();
    drupal_exit();
  }
  $keyword = check_plain($_POST['kwresearch_keyword']);
  $kid = check_plain($_POST['kid']);
  $deleted = kwresearch_delete_site_keyword($kid);
  $site_priority_options = kwresearch_get_priority_options();
  $output = array();
  $output['data'] = array(
    'kid' => (int) $kid,
    'keyword' => $keyword,
    'deleted' => (bool) $deleted,
  );
  drupal_json_output($output);
}