• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 348
  • Last Modified:

asp.net, jquery, and web services for 2nd drop down

I have the following codes and need some helps

if inputState is selected then

   using jquery to call webservices and return a array like ('policy1','policy2','policy3')
   fill up the <select> value


   leave the <select> alone


<div class="controls">
<input readonly="true" class="customstyle" type="text" name="inputState" id="inputState"  />
                                        <masteritem  id="states" class="border">
                                            <item data-id="AL">Alabama</item>
                                            <item data-id="AK">Alaska</item>
                                            <item data-id="CA">California</item>
                                            <item data-id="NY">New York</item>
                                            <item data-id="WY">Wyoming</item>                                            

<div class="type control-group">
<label class="control-label" for="inputType">
Policy Type
<div class="controls">
<select id="inputBondType" name="inputBondType">
<option id="908">Policy1</option>
<option id="472">Policy2</option>
<option id="105">Policy3</option>
</div><!-- /.controls -->
  • 3
  • 2
1 Solution
Where is your code that is doing the ajax request?
solution1368Author Commented:
have not done yet...can you show me how to do it in jquery?
solution1368Author Commented:
Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

It's too late for me now, will get back to it tomorrow if no one else takes it on.
Monica PSoftware DeveloperCommented:
This is the sample to load the data with webservice call in AJAX

<script language="javascript" type="text/javascript">
$(document).ready(function() {
type: "GET",
url: "../WebService.asmx/FindAllCountries",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(response) {
var ddl1 = response.d;
for (var i = 0; i < ddl1.length; i++) {
var selectOption = $(document.createElement(‘option’));
failure: function(errMsg) {

Open in new window

Refer this link for detailed code for the  Dropdown list upload

Tutorial for webservice call in ajax
solution1368Author Commented:
i need working codes with my codes that I posted.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now