こんにちは、私は、リストに移入したいselectタグは、ここで説明するためにいくつかのコードをオブジェクト持っている私は、次の質問を持っている一人一人、オプションの選択を移入します産業モデルのリストは、以下のiは春ブーツアヤックスは、動的に
function industryAjax()
{
\t alert("i am here")
var businessNatureId= $("#industrySelect option:selected").val();
\t
\t $.ajax({
\t \t url : getContextPath() + "/getAllIndustries",
\t \t type : "get",
\t \t success : function(response) {
\t \t \t $('#industrySelect').empty();
\t \t \t $('#industrySelect').append($('<option>', {
\t \t \t value: 0,
\t \t \t text: 'Select'
\t \t \t }));
\t \t \t for (item in response) {
\t \t \t \t $('#industrySelect').append($('<option>', {
\t \t \t \t value: response[item].industryId,
\t \t \t \t text: response[item].industryInEnglish
\t \t \t \t }));
\t \t \t }
\t \t },
\t \t error : function(e) {
\t \t \t // alert("Submit failed" + JSON.stringify(e));
\t \t }
\t });
}
そして、ここで私が使用していますジャバスクリプトです私のhtml
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-4">
\t <label>Industry</label> <select class="form-control m-b"
id="industrySelect" name="industryId" onchange="industryChange();">
\t \t <option value="0">Choose Industry</option></select>
<p id="chooseIndustry" style="color: red;">please choose a valid industry</p>
</div>
それでは、どのように私はよろしく
そして、上記のコードでの問題は何ですか? Look fines – StanislavL
残念ながら、ドロップダウンリストをクリックするとデータが取得されない –
クリックすると変更されるようになりました。問題は、業界を追加して業界リストを取得したときに問題になるデータです。私は理由を理解していない、任意の助けが評価されるだろう。 –