Vamshi P
Vamshi P

Reputation: 23

load multiple jsps into single div using jquery

I am loading dynamic .jsp files into a div using jquery .load() method like below

var docType = $("#documentType").val();
$("#documentProperties").load("doctypes/"+docType+".jsp");

This will happen when I select some option from a select box. There are jsp files which matches the option values of select box, so in that way whenever I change the select box value the respected jsp will load into the documentProperties div.

Here my requirement changed to add forms dynamically. When I click on a button another jsp should append to documentProperties.

I tried

$("#documentProperties").append("doctypes/"+docType+".jsp");

but it's not working, how can I load multiple files into a div dynamically???

Upvotes: 0

Views: 127

Answers (1)

mauretto
mauretto

Reputation: 3212

try:

$.get( "doctypes/"+docType+".jsp" )
  .done(function( data ) {
    $("#documentProperties").append(data);
});

Upvotes: 0

Related Questions