Reputation: 327
I have a button in a jsp page, on clicking the button, the page is submitted and then some validation takes place and finally one pop up is displayed.
But, when button is clicked the page is refreshed.
How can I avoid this?
My code:
jsp file:
<s:a href="#" accesskey="w" onclick="upload('checkWithdrawPlan')">
<img src="../../KY/images/common/buttons/plan_withdraw.png" alt="withdraw plan button" style="border: none;" />
</s:a>
<s:if test="#request.allowwithdrawPlan != null">
<s:include value="ConformationPopup.jsp"/>
js code:
function upload(action) {
document.PlanSummaryForm.action = action;
document.PlanSummaryForm.submit();
validNavigation = true;
}
Upvotes: 0
Views: 3300
Reputation: 137
There is no way to avoid page refresh with a normal submit behaviour, as Devesh said...you'll need to use some of ajax to process data without page refresh...
Upvotes: 0
Reputation: 4560
I think jquery AJAX call is your solution which you can implement without refreshing the page.
For serialization : http://api.jquery.com/serialize/ For AJAX : http://api.jquery.com/jQuery.ajax/
Upvotes: 2