how to send form's element data in controller

2020-04-14 16:35发布

问题:

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