2 Replies Latest reply on Mar 28, 2014 5:00 PM by iccsi

    trigger onchange event by load server data

    iccsi Level 1

      I have following code to filter my second list from my list.

      It works when user click the dropdown, since onchange event trigger.

      I tried to load the data from stored procedure then the onchange event does not trigger, when user need update data then will see whole list without filtering.

       

      I would like to know if it is possible to trigger onchange event when I load data from stored procedure,

      Your help and information is great appreciated,

       

      Regards,

       

      Iccsi,

       

      <td><select name="Mylst" id="Mylst">

       

               <cfoutput query="MySP">

                        <option value="#MySP.MyID#"

                <cfif (isDefined("form.MyID") AND form.MyID EQ MySP.MyID)>selected="selected"</cfif>> #MySP.MyName# </option>

       

                </cfoutput>

           </select></td>

       

       

       

       

       

      $("#Mylst").change(function()

              {    $.ajax({

                           type: "GET",

                           url:   'Mycfc.cfc?method=GetMethod&MyParam='+ jQuery("#MyPrelsty").val(),

                           dataType: "json",

                   cache: false,

       

                           success: function(data)

                           {

       

                    $('#MySublst option').remove();

       

       

       

               $.each(data, function(i, obj)

                        {

       

                   $("#MySublst").append('<option value=' + '"' + data[i][0] + '"' +'>' + data[i][1] +

       

      '</option>')

       

       

                 });

       

               }  

       

         });