jQuery Autocomplete with images :a small customization
<p>I am a newbie in jQuery. I am trying to use the auto complete jQuery pluggn in my ASP.NET page .I downloaded the sample from the site and trying to rewrite it from PHP to ASP.NET</p>

<p>Can any one help me to rewrite it ? </p>

<pre><code>&lt;script type="text/javascript"&gt;
</code></pre>

<p>$().ready(function() {</p>

<pre><code>function findValueCallback(event, data, formatted) {
 $("&lt;li&gt;").html( !data ? "No match!" : "Selected: " + formatted).appendTo("#result");
}

function formatItem(row) {
 return row[0] + " (&lt;strong&gt;id: " + row[1] + "&lt;/strong&gt;)";
}
function formatResult(row) {
 return row[0].replace(/(&lt;.+?&gt;)/gi, '');
}


$("#imageSearch").autocomplete("images.php", {
 width: 320,
 max: 4,
 highlight: false,
 scroll: true,
 scrollHeight: 300,
 formatItem: function(data, i, n, value) {
  return "&lt;img src='images/" + value + "'/&gt; " + value.split(".")[0];
 },
 formatResult: function(data, value) {
  return value.split(".")[0];
 }
});
</code></pre>

<p></p>

<p>and page contains</p>

<pre><code>&lt;input type="text" id='imageSearch' /&gt;
  &lt;input type="button" value="Get Value" /&gt;
</code></pre>

<p>Content of images.php</p>

<pre><code>$term = $_REQUEST['q'];
$images = array_slice(scandir("images"), 2);
foreach($images as $value) {
if( strpos(strtolower($value), $term) === 0 ) {
 echo $value . "\n";
}
</code></pre>

<p>}</p>

<p>I have some question on this</p>

<p>1 . I understand the images.php will return the list of images.Can any one provide me the format with an example ?Will that be a collection of list items,or divs or a single string seperated by some characters</p>

<p>2 . How the javscript is formating the output received.In my case i want to return a list of items(image names) and a Text (caption) with an id for it.So that users will see the image and the text in the option list and when he chooses,i want to show another page there ( i want to use the anchor tag there to navigate to another page with the id of option which user selected.</p>

<p>Kindly guide me  Thanks in advance</p>
