function json_clear_table() { $status = false; if (current_user_can('manage_options')) { $model = new AgmMapModel(); $status = $model->clear_table(); } header('Content-type: application/json'); echo json_encode(array('status' => $status ? 1 : 0)); exit; }