Reputation: 5585
I have a modal window called kmodal, which has some links in it. When i click one link, it provides me with an accept button. Now when i click this button, i have to bring my jsp within this modal without closing it and i have to get rid of other links without disturbing the lay out. How can i achieve this ?
I tried this one :
jQuery('#button').load('myJSP', function() {
jQuery(this).show();
But this does not work. Can any one suggest any ideas here ?
Upvotes: 1
Views: 3396
Reputation: 33661
You just need to do load without the callback function - and you don't want to load the jsp inside your button.. You want it in the modal. You can read more about .load() here
jQuery('yourmodalcontainer').on('click','#button',function(){
jQuery('yourmodalcontainer').load('myJSP');
// this will load your jsp into the modal
});
My example uses delegation as I don't know how/when your button is created
You need to use delegation when your elements don't exist in the dom at the time of binding.. So I'm actually not sure when your modal or how it's created also.. It's best to bind to the closest parent element that is static and available at dom ready.. but to be safe you can bind it to the body
jQuery('body').on('click','#button',function(){
Upvotes: 2