From 569ede574f2db14d7359b42e1ccbf5772a4554fb Mon Sep 17 00:00:00 2001 From: Steven Wittens Date: Fri, 22 Jun 2007 08:46:16 +0000 Subject: #115139: Add centralized json handler (and send text/javascript content-type header). --- modules/profile/profile.module | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'modules/profile') diff --git a/modules/profile/profile.module b/modules/profile/profile.module index c973986af..87238db73 100644 --- a/modules/profile/profile.module +++ b/modules/profile/profile.module @@ -742,16 +742,15 @@ function profile_form_profile($edit, $user, $category, $register = FALSE) { * Callback to allow autocomplete of profile text fields. */ function profile_autocomplete($field, $string) { + $matches = array(); if (db_result(db_query("SELECT COUNT(*) FROM {profile_fields} WHERE fid = %d AND autocomplete = 1", $field))) { - $matches = array(); $result = db_query_range("SELECT value FROM {profile_values} WHERE fid = %d AND LOWER(value) LIKE LOWER('%s%%') GROUP BY value ORDER BY value ASC", $field, $string, 0, 10); while ($data = db_fetch_object($result)) { $matches[$data->value] = check_plain($data->value); } - - print drupal_to_js($matches); } - exit(); + + drupal_json($matches); } /** -- cgit v1.2.3