问题
I'm calling struts 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 ?
回答1:
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.
来源:https://stackoverflow.com/questions/17071499/jquery-error-while-calling-struts-action