0

関数の変数を使用してオートコンプリート機能を作成しています。コードは次のとおりです。

 function autocomplete(mp_info){
        var request_data = {
                '_action': 'GET'
            };
        $(mp_info).find("#id_mp_element").autocomplete({
            source: function( request, response, elems ) {
                    alert("working");
                    $.ajax({
                        url: "/api/slots/"+request.term+"/12/",
                        dataType: "json",
                        type: 'POST',
                        data: request_data,
                        success: function( data ) {
                            response($.map(data, function(item) {
                                return {
                                    label: item.name,
                                    id: item.id,
                                    pos: item.position
                                }
                            }));
                        }
                    });
                },
                minLength: 2,
                select: function( event, ui ) {
                    var info_row = $(".info_row").has(this);
                    $($('td',info_row.parent().prev())[2]).text($(".info_row     #id_mp_element").val()+" / "+ui.item.pos);
                    $("#id_mp_s").val(ui.item.id);
                    $("#id_mp_position_metric").val(ui.item.pos);
                },
        });
    }   

テキスト入力に何かを書き込んだときに、IEに表示されないアラートメッセージ

4

1 に答える 1

3

最後に昏睡状態を取り除きます:

 select: function( event, ui ) {
                var info_row = $(".info_row").has(this);
                $($('td',info_row.parent().prev())[2]).text($(".info_row     #id_mp_element").val()+" / "+ui.item.pos);
                $("#id_mp_s").val(ui.item.id);
                $("#id_mp_position_metric").val(ui.item.pos);
            }            <------- there shouldn't be a come here
    });
于 2013-02-06T15:13:50.533 に答える