Hello all,
Here's some code that I've seen on the internet to help me out archieving more or less the same:
<input size="30" id="inputString" onkeyup="lookup(this.value);" type="text" />
function lookup(inputString) {
if(inputString.length == 0) {
// Hide the suggestion box.
$('#suggestions').hide();
} else {
$.post("rpc.php", {queryString: ""+inputString+""}, function(data){
if(data.length >0) {
$('#suggestions').show();
$('#autoSuggestionsList').html(data);
}
});
}
} // lookup
1) ** {queryString: ""+inputString+""} It's a json notation but why do we need the first "" and the last "" ?**
2) $('#autoSuggestionsList').html(data);
[UPDATE] This assumes that the returned data from or server side, comes in html format. What if, that format was in json, what do we need to modify here, to adapt it to json server side response? [/UPDATE]
Thanks, MEM