Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private Service Service;
- private Vehicule v;
- private Map<String, Object> map= new HashMap<>();
- public String query()
- {
- Service = new ServiceImpl();
- v = new Vehicule();
- v= Service.getVehiculeByImmat(field1);
- map.put("date", v.getdate().toString());
- map.put("kilometrage", v.getKilometrage());
- return "success";
- }
- $(document).ready(function(){
- $('#field1').change(function(){
- var selectedValue = $('#field1').val();
- if ($.trim(selectedValue).length > 0)
- {
- alert(selectedValue);
- $.ajax(
- {
- type: 'POST',
- url : "<s:url action='query'/>",
- dataType : 'json',
- data: { field1: selectedValue},
- success: function(result){
- $.each(result, function(key,value)
- { $("#"+key).val(value);
- } );
- },
- });
- }
- }
- );
- });
- <action name="query" class="action.GestionVehicules" method="query">
- <result name="success" type="json">map</result>
- </action>
- ActionContext.getContext().setLocale(Locale.US);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement