javascript - Getting specific content from page to be inserted to bootstrap 3 modal via ajax -


i trying pull specific content page bootstrap 3 modal via ajax can pull in whole page.

here jquery code:

function winemap() {      var wh = $(window).height();     var hh = $('#masthead').height();     $('.wine-menu #mainstage').css({         height: wh-hh-80     });     $('#wine-map').vectormap({         map: 'world_en',         backgroundcolor: '#000',         color: '#ffffff',         hoveropacity: 0.7,         selectedcolor: '#666666',         enablezoom: true,         scalecolors: ['#ffffff', '#eeeeee'],         normalizefunction: 'polynomial',         onregionclick: function(element, code, region){             if (code == 'us')    {                 var url = 'http://cb.dannycheeseman.me/wine-menu/'+code;             }             $('#themodal').modal({                 show : true,                 remote: url             });         }     }); }  $(document).ready(function(e) {     winemap(); }); 

here url http://cb.dannycheeseman.me/wine-menu/ (click on usa)

i have tried:

function winemap() {      var wh = $(window).height();     var hh = $('#masthead').height();     $('.wine-menu #mainstage').css({         height: wh-hh-80     });     $('#wine-map').vectormap({         map: 'world_en',         backgroundcolor: '#000',         color: '#ffffff',         hoveropacity: 0.7,         selectedcolor: '#666666',         enablezoom: true,         scalecolors: ['#ffffff', '#eeeeee'],         normalizefunction: 'polynomial',         onregionclick: function(element, code, region){             if (code == 'us')    {                 var url = 'http://cb.dannycheeseman.me/wine-menu/'+code;             }             $('#themodal').modal({                 show : true,                 remote: url+'#menu-home-location'             });         }     }); }  $(document).ready(function(e) {     winemap(); }); 

note the:

                remote: url+'#menu-home-location' 

i expect pull in content of id still pulling in whole page..

regards

ok, after reading on jquery load function have realised need space before id of content wish add so:

            $('#themodal').modal({                 show : true,                 remote: url+'#menu-home-location'             }); 

becomes:

            $('#themodal').modal({                 show : true,                 remote: url+' #menu-home-location'             }); 

and works great.


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -