Can I make a .json call on select event from jQuery autocomplete?

Can I make a .json call on select event from jQuery autocomplete?

I have an application that allows users to select an activity (such as watching movies or aikido) from a jQuery autocomplete box. That part is working. What I want, however, is for some boxes that allow a user to select their expertise to either be disabled if expertise isn't relevant (such as watching movies) or enabled if expertise is relevant. To do this, I'm trying to call a $.getJSON from within the autocomplete select event. The $.getJSON calls a server-side php script that asks a mysql database if the activity just selected requires expertise. It doesn't seem to be calling the $.getJSON, however.

Here is my HTML:

<label for="activity">Select Activity:</label> <input id="activity">

Here is my Javascript:

$( "#activity" ).autocomplete({ minLength: 2, source: "php/getActivities.php", select: function(event, ui) { // Call the server side script to determine whether or not this activity // requires expertise or not queryString = 'activity=' + encodeURIComponent(ui.item.value); alert (queryString); jqxhr = $.getJSON('php/checkActivityExpertise.php',queryString,function(data2) { alert('in .getJSON'); if (data2.needExpertise) { activateBoxes(); } else { deactivateBoxes(); } }).fail(function(jqxhr, textStatus, error) { var err = textStatus + ", " + error; alert("Request Failed: " + err); }); // end of $.getJSON call } // end of select: function }); // end of activity.autocomplete

And here's the PHP function:

<?php // checkActivityExpertise.php // Connect to database include_once 'dbConnect.php'; include_once 'sanitizeString.php'; $activity = sanitizeString($_GET['activity']); // query database on whether or not expertise is needed $query = "SELECT displayExpertise FROM activities WHERE activity=$activity"; $resource = mysql_query($query); $row = mysql_fetch_row($resource); $needExpertise = $row[0]; // Return the flags back to calling function $arr = array('needExpertise' => $needExpertise); echo json_encode($arr); ?>

The alert(queryString); works find - so it's getting this far - it displays the queryString as "activity=Aikido". It displays the error: "Request Failed:  parsererror, SyntaxError: Unexpected token <" I've tried commenting out all of the php function - so I'm wondering if I just cannot call $.getJSON from inside of an autocomplete select event?

Thanks,

Tom