I'm using the code below to send the selected option to a php file, and let the php file return something, that will be displayed in the div: details.
So far no problem, but I wan't to post some additional information to my php file, namely two hidden input fields. I haven't got a clue how I can add these two input fields to the data being sended, so I appreciate any help.
My coding:
- <select style="margin-top:5px;" id="report">
- <option value="">Select Category:</option>
- <option value="spam">Spam</option>
- <option value="tosv">TOS violation</option>
- </select>
- <input type="hidden" id="product_id" value="1234">
- <input type="hidden" id="extra" value="54321">
-
- <div id="details"></div>
-
- <script>
- $('#report').change(function(){
- $(report).hide();
- $.ajax({
- url: "something.php",
- type: "post",
- data: {option: $(this).find("option:selected").val()},
- success: function(data){
- //adds the echoed response to our container
- $("#details").html(data);
- }
- });
- });
- </script>