No. All of the examples I find are like the 'google' style suggest-thingy.
I want to dynamically (AJAX) populate an actual:
<select>
<option value='1'> foo
<option value='2'> bar
<option value='3'> fee
<option value='4'> fum
</select>
Basically the core problem is passing back an 'array' of data from mysql
into JS to make the box.
What I've 'hacked' together so far is that I return my values like so from
PHP/mySQL to JS AJAX:
$tmp = "1|foo|2|bar|3|fee|4|fum";
And then in JS, I do this:
tokens = tmp.split('|');
Then use a for(i++2) loop and build up the options (key and value) of the
select box.
But, to me this seems like a hack.
Plus I'm a little worried that there is going to be a size limit of
characters or data or something? After all, AFAIK AJAX uses $_GET method
right? Not $_POST. So I think GET has a limit of like 1024 characters,
whereas POST doesn't have that limit.
My select box could have potentially thousands of items in it. Say for
example, IP addresses. I have supporting select boxes to filter by ranges,
or groups, or whatever, but there's nothing restricting a user from NOT
using them, and just wanting to see ALL the IP addresses...
So, I guess what I'm asking, is, is this the right way to solve this
challenge, or is there a better/more accepted way?
A better acceptable way? I'm clueless as to what is better. Ajax is
too new to me to make a determination as to what is the best or
acceptable way.
I just know that ajax can be used to replace the contents between
specific tags in an html document without having to reload the entire
page. So, I don't see any reason why you can't replace stuff between
<select> tags with stuff you pull out from mysql.
As far as the limit, your assumption is not correct. I just tried a
test of over 14,000 characters with no problem at all, see:
http://www.xn--ovg.com/ajax1 Click First page
So, you shouldn't have any problem populating a select box with
thousands of characters -- although you may want to LIMIT that in
your mysql and pull it out in shorter segments.
tedd
--
--------------------------------------------------------------------------------
http://sperling.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php