0

How can I get a selected variables from multiple select box then do a $.post request to the server?

I see that there is a data input under jQuery documentation and it says the type is either object or string but I cannot seem to figure out how I can transform retrieved selected values from multi select box via jQuery, add another field and value called {check_industry: "1"} then add this as a data below where it says {here}

$.post("/get-tree", {here},
                 function(data) {
                   console.log(data);
                 }, 
                 "html"
                );
Jae Kun Choi
  • 2,011
  • 5
  • 25
  • 32
  • can you clarify what you mean by "get a selected variables from multiple select box then do a $.post"? Are you just trying to do an AJAX call using a select control? – Codeman Mar 20 '13 at 00:57

1 Answers1

1

Expanding on @clav to limit to just one select item of interest:

$.post("/get-tree", 
    { check_industry: $('#idOfSelectBox').val() },
    function(data) {
        console.log(data);
    }, 
    "html"
);
Geoff
  • 3,749
  • 2
  • 28
  • 24