Note that there are some explanatory texts on larger screens.

plurals
  1. POError when using jquery webservice call to populate dropdownlist
    text
    copied!<p>For some reason when i tested parsing a json string to a dropdownlist it worked doing this</p> <pre><code> var json = [{ "Id": "12345", "WorkUnitId": "SR0001954", "Description": "Test Service Request From Serena", "WorkUnitCategory": "ServiceRequest" }, { "Id": "12355", "WorkUnitId": "WOR001854", "Description": "Test Work Order From Serena", "WorkUnitCategory": "ServiceRequest" }, { "Id": "12365", "WorkUnitId": "DBR001274", "Description": "Test Database Related Service Request From Serena", "WorkUnitCategory": "ServiceRequest"}]; $(json).each(function() { comboboxWorkUnit.append($('&lt;option&gt;').val(this.Id).text(this.WorkUnitId)); }); </code></pre> <p>However when i tryed taking the json from my webservice and placing it into the dropdownlist i get an error saying the <strong>dropdownlist doesnt support this metod</strong>.</p> <pre><code>$.ajax({ type: "POST", url: "Services/WorkUnitService.asmx/WorkUnit", data: "{'Number' : '" + Number.text() + "','Id': '" + combobox.val() + "','workerType': '" + EmployeeType + "'}", contentType: "application/json; charset=utf-8", dataType: "json", success: function(json) { $(json).each(function() { comboboxWorkUnit.append($('&lt;option&gt;').val(this.Id).text(this.WorkUnitId)); }); } }); </code></pre> <p>I also tried which called the webservice method but through an error</p> <pre><code> $.postJSON("Services/WorkUnitService.asmx/WorkUnitsForParAndPhase", "{'parNumber' : '" + parNumber + "','phaseId': '" + combobox.val() + "','workerType': '" + EmployeeType + "'}", function(data) { alert(data.toString()); }); </code></pre> <p>And i tryed this which never called the webservice</p> <pre><code> $.getJSON('Services/WorkUnitService.asmx/WorkUnitsForParAndPhase' + parNumber + '/' + combobox.val() + '/' + EmployeeType, function(myData) { alert(myData.toString()); }); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload