Reputation: 5654
How can you use AJAX to post jsp pages to a SpringMVC controller. I would like to integrate AJAX into a SpringMVC application. Also would it be better to use html list box and set an event on it so any changes to the data in the database can be persisted when the user clicks on the item or can this be accomplished very easily with JQuery controls.
I am new to using AJAX so i would like if someone can point me in the direction of a good example on posting a form to a controller for processing using AJAX and also the use of JQuery controls that bind to a database.
Upvotes: 0
Views: 2546
Reputation: 1866
Following is the jquery way of making an AJAX call.
$(".delete").click(function(){
$.ajax({
url: '<c:url value="/relyingparty/delete"/>' + '?id=' + $(this).attr("refId") ;,
type: 'POST',
success: function(result) {
}
});
});
(This is just a sample and not a complete working one)
For the url that is mentioned above you should have a Spring MVC controller with a method annotated with @RequestMapping
@RequestMapping(value = "/delete", method = RequestMethod.DELETE)
public String deleteRelyingParty(@RequestParam(required = true) Integer id){
}
Upvotes: 1