Having an issue with jqm and the jqm.autoComplete plugin.
I'm not getting any output displayed from my autocomplete plugin. According to firebug, I seem to be getting data back from the call to my external php script. I've also tried running my php from the cl and I get the results that I expect. I'm not sure where I've botched things up.
Stuff in the head:
- <script src="../../jquery/jquery-1.7.2.min.js"></script>
<script src="../../jquery/jqm.autoComplete.min-1.4.2.js"></script>
<script src="../../jquery/mobile/jquery.mobile-1.1.0.min.js"></script>
Form text field that I want autocomplete to work for:
- <label for="cusNum"><strong>Customer Number:</strong></label>
<input type="text" name="cusNum" id="cusNum" value="" />
<ul id="suggestions" data-role="listview" data-inset="true"></ul>
Script call function:
- $(document).ready(function() {
$('#cusNum').autocomplete(
{
target: $('#suggestions'),
source: "cusNumfind.php",
minLength: 3
});
I have my suspicions about the below code. I'm not convinced I have my output right so I've tried several things without a change in my results. Portion of cusNumfind.php:
- $json = '[';
$first = true;
while($row = $sth->fetch(PDO::FETCH_ASSOC))
{
if (!$first) { $json .= ','; } else { $first = false; }
$json .= '{"value":"'.$row['CustomerNumber'].'"}';
// $json .= '"'.$row['CustomerNumber'].'"';
}
$json .= ']';
echo $json;