[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

force the jquary change function

Posted on 2014-03-04
2
Medium Priority
?
221 Views
Last Modified: 2014-03-04
I'm working on a mysql/php form. I am repopulating the form on page load.  My question is how do I force the change function in the ajax function, which is used in a dependent select box.

 The Ajax script is:

<script type="text/javascript">// Dynamic Support Select based on Depth
           $(document).ready(function(){
                     $("#Depth").change(function(){
                     var depth=$("#Depth").val();
                     $.ajax({
                        type:"post",
                        url:"support_get.php",
                        data:"depth="+depth,
                        success:function(data){
                              $("#A_Sup").html(data);
                                            $("#B_Sup").html(data);
                        }      
                     });
            
               });
           });
            
      </script>


The function to repopulate the page steps through the form setting values based on saved values in the mysql table. I was setting the value of 'Depth' and then trying to trigger as follows, but it doesn't fire. ???


      form1.Depth.value="<?php echo $row_Quote['Depth']; ?>";

      $("Depth").trigger("change");
            
      setSelectedIndex_val(document.getElementById("A_Sup"),"<?php echo $row_Quote['A_Sup']; ?>");
      setSelectedIndex_val(document.getElementById("B_Sup"),"<?php echo $row_Quote['B_Sup']; ?>");
0
Comment
Question by:jws2bay
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 23

Accepted Solution

by:
Snarf0001 earned 2000 total points
ID: 39904400
If the code above is correct, you're just missing the #

$("Depth").trigger("change");
-- change to --
$("#Depth").trigger("change");
0
 

Author Comment

by:jws2bay
ID: 39904639
That's it.  Works fine.

Thanks
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
When the s#!t hits the fan, you don’t have time to look up who’s on call, draft emails, call collaborators, or send text messages. An instant chat window is definitely the way to go, especially one like HipChat. HipChat is a true business app. An…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question