<input type="checkbox" name="food1" value="apples'>Apples
<input type="checkbox" name="food2" value="Pizza'>Pizza
<input type="checkbox" name="food3" value="Cake'>Cake
Inputs are "keyed" on their "name" not their "id".
Karl Rudd
On Wed, Dec 31, 2008 at 7:53 AM, tradeallday <jonathanpatton@gmail.com> wrote:
>
> I've got checkboxes on my page. When I use the $.post method, it's
> only transmitting the first value out of my list. Here's my code:
>
> $.post("http://localhost/search_engine.php",{
> food_type: $("#food_type").val(),
> foods: $(":checkbox").fieldValue(),
> }, function(xml) {
> displayResult(xml);
> });
>
> the checkboxes look like this:
>
> <input type=checkbox id=foods value="apples'>Apples
> <input type=checkbox id=foods value="Pizza'>Pizza
> <input type=checkbox id=foods value="Cake'>Cake
>
> If I check all three, I only get the first one, although if I do an
> alert of
>
> $(":checkbox").fieldValue()
>
> I get back all the results I selected.
>
> I'm using the jquery form library jquery.form.js.
>
> Should I be posting this data some other way? Or is my syntax wrong?
>
> Thanks,
>
No comments:
Post a Comment