I have the following code in jsp page
<c:choose>
<c:when test="${action == 'action1'}">
Show me Part 1
</c:when>
<c:when test="${action == 'action2'}">
Show me Part 2
</c:when>
</c:choose>
I want to make a ajax call that will give the the value of "action" variable where this ajax call will connect with sevlet and that servlet will give me the value for action. so if servlet gives me the the value "action2" then "show me Part 2 should be visible"
I have done the following in JS and its calling this function on a button click action
function f1() {
$.ajax({
url: '/ProjectName/ServletName?action=ajtest',
data: {test: "test"},
success: function(response) {
}
});
}
I am getting the response normally without any problem but i want to set the value for action variable and see the result accordingly.
How to do this?