Question

I'm calling Struts 2 action from jQuery like below code.

jQuery( "#dialog-form" ).dialog({ 
    autoOpen: false,
    height: 300,
    width: 350,
    modal: true,
    buttons : {
        "Search" : function() {
            jQuery.ajax({
                type : 'POST',
                url : ' <s:submit action="part" method="find" /> '
             })
        }
    }
});

Is there any way to call struts action from jquery ?

Was it helpful?

Solution

Use

jQuery("#dialog-form").dialog({ 
  autoOpen: false,
  height: 300,
  width: 350,
  modal: true,
  buttons : {
    "Search" : function() {
      jQuery.ajax({type : 'POST',
        url : '<s:url action="part" method="find"/>'
      }); 
    } 
  }
});

submit tag will not render the url, use url tag instead.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top