2

Right now i'm using jsp and bootstrap to make my front-end, and i have an option to make a new register inside a modal and this new register needs to be in my behind screen, in the past projects I used angular and it was very easy to do, but now using jsp I haven't any ideia to make it without submit my modal.

Is there a way to make it without submit my modal?

camelCaseCoder
  • 1,447
  • 19
  • 32

1 Answers1

3

You can use Ajax, that way you can post the form to back-end to make what you need to do and than return the object to front-end.

Seeing your tags you're be able to make like that

Controller:

@Post
public void methodName(final T entity) {
    .
    .
    .
    result.use(Results.json()).withoutRoot().from(insertedObject).serialize();
}

Front:

$.ajax({
   type : 'POST',
   url : 'method url',
   data : form.serialize(),
   success : function(data){
       // data is the object inserted
   }
});
Rafael Lima
  • 509
  • 5
  • 13