How do submit an object to a struts2 action using jQuery?
- by James Drinkard
I have an object that I'm populating from a selection off a table row that a user selects. I have a jQuery function that captures the click event and a hidden form field populates an id I need.
However, I'm not sure as to the proper way to send off that object to a struts2 action? I tried using this:
$(function() {
$('#tbl tr').click(function() {
var id = $(this).closest('tr').find('input:hidden').val();
var page = "<s:url action='update/deleteInfo.action'/>?model.isDelete=true&model.info.id=id";
console.log(page);
window.location.href=(page);
});
});
The model object has an isDelete boolean variable and the model has a nested info object that has an id variable with getter/setters.
However, when I send this across, the model object isn't populated with these entries. Is there a way to do this or a better way than the url tag?