Passing hidden Field Value with Ajax

If got two related selects that are working perfectally using:

   $("#fac_name").change(function() {
     var id=$(this).val();
     var dataString = 'id='+ id;
     $.ajax
       ({
        type: "POST",
        url: "qry/ajax_proceedures.php",
        data: dataString,
        cache: false,
        success: function(html) {
          $("#proceedure_type").html(html);
        }
       });
   }); 
   $('#fac_name').trigger('change');
});

However, in some instances, the first dropdown #fac_name won’t be present on the page.
Instead there will be a hidden field with the same name - #proceedure_type - in the place of the dropdown.
My problem is - I need to get the 2nd dropdown to load from whatever value comes up in the hidden field when the page loads. I’m just not sure how to to get it to do that.
Suggestions please

then you can load the second dropdown directly, as the value of a hidden field cannot be changed directly. i.e. either the value is present from the beginning, or you use JS to set the value in which case this setting code would be responsible for loading the new content.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.