Using a spring web application, I need to call a controller in a java file from a JSP file using an ajax function. How can I achieve this?
<p class="bottom-slide-corners">
<a class="billing" href="#Billing"><spring:message code="billing_area" /></a>
</p>
$('.billing').on('click', function(event) {
clearSliderInterval();
var $this = $(this);
var $linkToFind = $($this.attr("href") + "_billing");
var $slidesToFind = $("." + $this.attr("href").replace("#", "") + "_slide");
if($this.parent().parent().siblings('.current-arrow').find('img').is(":visible")) {
$this.parent().parent().siblings('.current-arrow').find('img:visible').slideUp();
$('.Background').slideUp(function() {
$(".learn_more").hide();
}).removeClass("open");
return false;
}
if($window.width() <= 767) {
$('#dashboard-mobile-banner, #header-bg, #footer-container, .container-slider').slideUp();
var categoryClass = $linkToFind.attr('id').replace("learnMore", "slide");
$('.courseDashboard').removeClass().addClass("courseDashboard Background " + categoryClass);
$('body, html').animate({ scrollTop: 0 }, "fast");
}
if($('.learn_more').is(":visible")) {
$('.Background').slideUp(function() {
$('.learn_more').hide();
$linkToFind.show();
$('.Background').slideDown();
});
} else {
$linkToFind.show();
$('.Background').slideDown(function() {
if ($window.width() <= 767) {
var slider = $("#" + $linkToFind.attr('id') + " .thumbview").bxSlider({
slideWidth: 300,
pager: false
});
$('.close-panel:visible').on('click', function(e) {
slider.destroySlider();
});
}
}).addClass("open");
}
$('.current-arrow img:visible').slideUp();
$slidesToFind.find('.current-arrow img').slideDown();
return false;
});
When the above content is clicked, I want to call the following controller in a .java file. How can I write the code to accomplish this in a JSP file?
@RequestMapping(value = "/billing", method = RequestMethod.POST)
public String Billing(@RequestParam Long caseId,
@RequestParam Long noteID, HttpServletRequest request) throws Exception {
try{
----------
logger.debug("success ");
return "success";
} catch (Exception e) {
logger.error(e,e);
throw e;
}}