开发者

Jquery/struts 1 combobox dynamic

开发者 https://www.devze.com 2023-01-25 19:21 出处:网络
I have two combobox which are linked i.e if you select one , another combobox will have corresponding data. I am using jQuery to call the struts action via ajax. From struts actions side, it is sendin

I have two combobox which are linked i.e if you select one , another combobox will have corresponding data. I am using jQuery to call the struts action via ajax. From struts actions side, it is sending the latest data based upon the valuse selcted from first copmbobox but it is not reflected on the page. Do I have to refresh the whole page/form? If yes, then what is the point of using ajax?

$(document).ready(function() { 

        $("#marketchange").change(function() { 
            var marketCode = $(this).val();
            //var marketCode1 = document.getElementById("marketCode").value();
            //alert(marketCode1);
             $.ajax({  
                 type: "GET",  
                 url: '<%=contextPath%>/manageRangesAction.do?actionToTake=getIslandsForMarket',  
                 data: ({ market: marketCode }),
                 success: function(data){
                    alert(data)
                  }
             });   
            });

The data in form is not updated. From struts side the arraylist for second combobox is changed but not refreshed on the jsp page.

And in general how do 开发者_运维问答we update the form data whenever we make any ajax call to server side?


At work we use AjaxTags

0

精彩评论

暂无评论...
验证码 换一张
取 消