how to send form's element data in controller classin play /scala

空扰寡人 提交于 2019-12-31 03:26:09

问题


my routes.conf
POST    /getVerticalIndustry1/:guid     controllers.Application.getVerticalIndustry(guid)

my html javascript

 $('#partyId').on('change', function(event) {



          var selected_resource_id = $(this).val();

            if(selected_resource_id==="Others"){
           document.getElementById('pid').style.display='block';
           }
           else
            document.getElementById('pid').style.display='none';


          $.ajax(


                    {       type : 'POST',
                            url : '@routes.Application.getVerticalIndustry()',
                           data:{guid:$('#partyId').val()},

                            success : function(data)
                            {

                                alert($('#partyId').val()+" "+data);


                            }


                    });

        });



    </script>

def getVerticalIndustry(guid:String)=Action{
Ok(""+guid)
}

this code is working fine with constant when I am giving constant insted of element value .party id is the drop down element in form and I want to send this form element value in contoller class can someone help me what I am missing or how can I send this element value in contoller class.

my play version is 2.1.5

来源:https://stackoverflow.com/questions/33200986/how-to-send-forms-element-data-in-controller-classin-play-scala

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!