Skip to content Skip to sidebar Skip to footer

How To Call Struts Action From Plain Javascript File

This query is related to struts 1.3. Let's say I have one action called 'getName.do' which is mapped to 'GetName.java' action class. In the dmexecute method of this action class,

Solution 1:

You can use jQuery ajax for this purpose.

Importing jquery file:

<scriptsrc="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>

Calling action through jquery ajax:

<scripttype="text/javascript">
$.ajax({
    url : "getName.do?parameter=value",
    type : "POST",
    success : function(data) {
        // You'll get your response herealert(data);
    }
});
</script>

Hope this will help.

Post a Comment for "How To Call Struts Action From Plain Javascript File"