Hello.
There are 4 selects (with ID #model, #color, #size, #amortizator), the last 3 depend on the value of 1 select. Having chosen the value in the upper select, the available values in the lower 3 should load.
This is done by me:
$(document).ready(function(){ $("#model").change(function(){ var ramavalue = $("#model option:selected").val(); //alert(ramavalue); $("#color").load('/const/api.php?ramaid='+ ramavalue +'&color=y'); $("#size").load('/const/api.php?ramaid='+ ramavalue +'&size=y'); $("#amortizator").load('/const/api.php?ramaid='+ ramavalue +'&amortizator=y'); var amzid = $("#amortizator option:selected").val(); $(".amortizatordesc").load('/const/api.php?amzid='+ amzid +'&amortizatordesc=y'); }); $("#amortizator").change(function(){ var amzid = $("#amortizator option:selected").val(); $(".amortizatordesc").load('/const/api.php?amzid='+ amzid +'&amortizatordesc=y'); }); });
the top selector has #model, the values of the remaining 3 are normally loaded when selecting / changing the option at the top.
The problem is in the extra field. The <p></p>
with the .amortizatordesc class should load a description of the value from 4 selects with the #amortizator id. But when you open the page initially in the tag is empty. When changing the same value in 1 selector, the description of the past select is loaded into the tag. That is, there is a lag.
When changing the value manually in 4 #amortizator selects, everything is fine. And when changing the upper value of the #model select shows the description of the previously selected select.
Not quite clearly written, but I hope someone will understand what my problem is.