Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/472.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript ,el显示数组中的对象。 function autoCompleteCheckRun() { $('#autocompleteCR') .autocomplete({ minLength: 0, _Javascript_Jquery_Ajax_Autocomplete - Fatal编程技术网

Javascript ,el显示数组中的对象。 function autoCompleteCheckRun() { $('#autocompleteCR') .autocomplete({ minLength: 0,

Javascript ,el显示数组中的对象。 function autoCompleteCheckRun() { $('#autocompleteCR') .autocomplete({ minLength: 0, ,javascript,jquery,ajax,autocomplete,Javascript,Jquery,Ajax,Autocomplete,,el显示数组中的对象。 function autoCompleteCheckRun() { $('#autocompleteCR') .autocomplete({ minLength: 0, source: function (request, response) { $.ajax({ type: "POST",

,el显示数组中的对象。
function autoCompleteCheckRun() {
$('#autocompleteCR')
          .autocomplete({
              minLength: 0,
              source: function (request, response) {
                  $.ajax({
                      type: "POST",
                      contentType: "application/json; charset=utf-8",
                      url: './PayInvoicesWS.asmx/GetCheckRun',
                      data: "{'description':'" + document.getElementById('autocompleteCR').value + "'}",
                      dataType: "json",
                      success: function (data) {
                          var rows = autocompleteJSONParseCode(data);
                          response(rows);
                      },
                      error: function (result) {
                          alert("Error");
                      },
                      select: function (event, ui) {
                          var checkRunData = $("#CheckRunDescription");
                          var checkRunID = $("#CheckRunID");
                          checkRunData.val(ui.item.label);
                          checkRunID.val(ui.item.value);


                      }
                  });
              }
          });
 }

function autocompleteJSONParseCode(data) {
    var rows = new Array();
    var rowData = null;
    for (var i = 0, dataLength = data.d.length; i < dataLength; i++) {
        rowData = data.d[i];
        // alert(rowData.term2+":"+rowData.term1);//uncomment to see data as it parses
        rows[i] = {
            value: rowData.CheckRunID,
            label: rowData.Description
        };
    }

    return rows;
}

div class="ui-widget">
                        <label for="autocompleteCR" id="checkRunLabel">Check Run Lookup:</label>
                        <input type="text" id="autocompleteCR" />
                    </div>
$('#autocompleteCR')
          .autocomplete({
              minLength: 0,
              source: function (request, response) {
                  $.ajax({
                      type: "POST",
                      contentType: "application/json; charset=utf-8",
                      url: './PayInvoicesWS.asmx/GetCheckRun',
                      data: "{'description':'" + document.getElementById('autocompleteCR').value + "'}",
                      dataType: "json",
                      success: function (data) {
                          var rows = autocompleteJSONParseCode(data);
                          response(rows);
                      },
                      error: function (result) {
                          alert("Error");
                      }
                  });
              },
              select: function (event, ui) {
                          var checkRunData = $("#CheckRunDescription");
                          var checkRunID = $("#CheckRunID");
                          checkRunData.val(ui.item.label);
                          checkRunID.val(ui.item.value);


              }
          });
$( "#tags" ).autocomplete({
  source: availableTags,
  select: function(event, ui) {
            alert('Label is :' + ui.item.label + ' and Value is : ' +ui.item.value);
    }
});
function(el) {
return {
     CheckRunID: el.CheckRunID,
     Description: el.Description
     };
}));
function(el) {
return {
     value: el.CheckRunID,
     label: el.Description
     };
}));
checkRunData.val(ui.item.CheckRunID + ui.item.Description);
checkRunData.val(ui.item.label + ui.item.value);
function autoCompleteCheckRun() {
$('#autocompleteCR')
          .autocomplete({
        minLength: 0,
        source: function(request, response) {
            $.ajax({
                type: "POST",
                contentType: "application/json; charset=utf-8",
                url: './PayInvoicesWS.asmx/GetCheckRun',
                data: "{'description':'" + document.getElementById('autocompleteCR').value + "'}",
                dataType: "json",
                success: function(data) {
                    var el = data.d;
                    response($.map(el,
                        function(el) {
                            return {
                                label: el.Description,
                                value: el.CheckRunID
                            }
                        }));
                },
                error: function(result) {
                    alert("Error");
                }
             });
            },
            select: function (event, ui) {
                  $("#CheckRunDescription").val(ui.item.label);
                  $("#CheckRunID").val(ui.item.value);
                event.stopPropagation();
            }

          });
      }
 <div class="ui-widget">
                        <label for="autocompleteCR" id="checkRunLabel">Check Run Lookup:</label>
                        <input type="text" id="autocompleteCR" />
                    </div>
<div class="divTableCell">
                <label for="CheckRunDescription" id="checkRunDescriptionLabel">Description:</label>
                <input type="text" id="CheckRunDescription" style="width: 270px;" />
            </div>