在ajax调用中将参数作为字符串传递

Whenever this code is running when we pass variable in numbers, at the same time when i use string this code is not working.. any help greatly appreciated.

<script type="text/javascript">
        $(document).ready(function(){
           // $("input#pnum").hide();
            $("#cat").change(function(){
                var deptid = $(this).val();
//var value = $( this ).val();
//    $( ".deptid" ).text( value );
                $.ajax({
                    url: 'ajaxdropdown.php',
                    type: 'post',
                    data: {depart:deptid},
                    dataType: 'json',
                    success:function(response){

                        var len = response.length;
                        var name1234 = "";
                        $("#pnum").empty();
                        for( var i = 0; i<len; i++){
                            var id1234 = response[i]['id123'];
                            name1234 += (name1234.length < 1) ? response[i]['name123'] : ',' + response[i]['name123'];
                          $("#pnum").val(name1234);
                        }
                    }
                });
            });

        });
    </script>