Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

trigger onchange event by load server data

Engaged ,
Mar 27, 2014 Mar 27, 2014

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[0] + '"' +'>' + data[1] +

'</option>')

           });

         }  

   });

802
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Mar 28, 2014 Mar 28, 2014

iccsi wrote:

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

Yes, it is of course possible. The environment in which the event takes place - the browser - is independent of the environment in which data is loaded from the stored procedure - the ColdFusion server.

Any problem you face are probably JQuery ones. A similar question was answered in Stackoverflow.

Translate
Community Expert ,
Mar 28, 2014 Mar 28, 2014

iccsi wrote:

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

Yes, it is of course possible. The environment in which the event takes place - the browser - is independent of the environment in which data is loaded from the stored procedure - the ColdFusion server.

Any problem you face are probably JQuery ones. A similar question was answered in Stackoverflow.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 28, 2014 Mar 28, 2014
LATEST

Thanks for the information and help,

Regards,

Iccsi,

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources