需要AJAX帮助

i have problem in ajax.. im new comer for ajax...:)

<script type="text/javascript">
$(document).ready(function()
{
    $("#bcode").focus();
    //prevents autocomplete in some browsers
    $("#bcode").attr('autocomplete', 'off').keyup(function(event)
    {
        var name = $("#bcode").val();



            $("#status").empty();
            if(name.length > 17 )
            {
                selectAll();

                $("#status").html('<img align="absmiddle" src="loading.gif" /> Checking availability...').show();
                $.ajax({
                type: "POST",
                url: "namecheck.php",
                data: "bcode="+ name,
                success: function(msg)
                {
                    $("#status").html(msg).show();
                }
                });

        }
        else
        {
            $("#status").html('').addClass('err').show();
        }
    });
});

//-->

</script>

i got text box value 'bcode' using '$_POST['bcode']'

<input name="bcode" type="text" class="bcode" id="bcode" maxlength="18"; />

also i have menu/list in that form

<select name="pallete" class="list_box" id="select">
                <option value="P0" selected> </option>
              <option value="P1">P1</option>
              <option value="P2">P2</option>
              <option value="P3">P3</option>
              <option value="P4">P4</option>
              <option value="P5">P5</option>
</select>

How i can access selected item from php file by using '$_POST['pallete']'

please help me.

Thanks in advance..

The same way you've retrieve the value for 'bcode' and stored it into a variable to pass through on the AJAX call, you should do another for 'pallete' and append it on the AJAX call. See below:

var pall = $("#pallete").val();

data = "bcode=" + name + "&pallete=" + pall;

You are sending only the bcode text box value with post. With that you can send other data also.

Try this,

var name = $("#bcode").val();
var selectedVal=$("#pallete .selected").val();

     $.ajax({
                    type: "POST",
                    url: "namecheck.php",
                    data:  { bcode: name, SelectedVal: selectedVal },
                    success: function(msg)
                    {
                        $("#status").html(msg).show();
                    }
                    });