locked
Dialog Box from Autocomplete Select RRS feed

  • Question

  • User1122355199 posted

    Hello everyone and thanks for your help in advance.  I am trying to open a jQuery dialog after a selection is made from an automcomplete widget.  Ultimately, I want to pass a parameter into the dialog and in turn make an ajax call to populate informational data in the dialog.  Here is my code:

    $(document).ready(function () {
    
        // Begin New Problem Dialog Box
        //alert('dialog');
        $("#divLabOrderNotification").dialog({
            autoOpen: false,
            width: 'auto',
            modal: true,
            buttons: {
                "Cancel": function () {
                    $("#divLabOrderNotification").dialog("close");
                },
                "Save": function () {
    
                    })
    
    
                    })
    
                    $("divLabOrderNotification").dialog("close");
                },
            }
        });
    
        $(".srchlaborder").autocomplete({ minLength: 2 }, {
    
            scroll: true,
            source: function (request, response) {
                $.ajax({
                    //Begin Ajax code
                    type: "GET",
                    contentType: "application/json; charset=utf-8",
    
                    url: searchUrl + request.term,
    
                    dataType: "json",
                    async: true,
                    success: function (data) {
                        //response(data.d);
    
                        response($.map(data, function (item) {
                            //return { value: item.value, id: item.label }
                            return { value: item.LONG_COMMON_NAME, id: item.label }
                        }))
    
                    },
                    error: function (result) {
                        alert("Due to unexpected errors we were unable to load data");
                        //debugger;
                    }
                    //End of Ajax code
                })
    
                //End of source data code
    
            },
    
            select: function (event, ui) {
                alert('selected'); // this works
                $("divLabOrderNotification").dialog('open');  // this doesn't
            }
    
        });
    
    });

    The alert within the select function works, but the dialog does not open.  Any help would be appreciated.

    Friday, March 23, 2018 2:08 AM

Answers

All replies