3
When the page fully loads it starts a function, I would like when clicking a button that same function initializes again by passing a text like Query String
. I have the code:
$(document).ready(function() {
function initMapplic(title){
var mapplic = $('#mapplic').mapplic({
source: '<?php echo base_url();?>assets/plugins/mapplic2/server.php?title='+title, // Using mall.json file as map data
sidebar: false, // Enable sidebar
developer:true,
minimap: false, // Enable minimap
markers: true, // Disable markers
fillcolor: true, // Disable default fill color
fullscreen: true, // Enable fullscreen
maxscale: 3 // Setting maxscale to 3
});
}
initMapplic('');
$("#searchfilters").on('click',function(){
initMapplic('apertou');
});
});
It starts normally, but when I click on the button it doesn’t seem to update by passing the text "pressed" how I would like.
It didn’t work, it’s still the same thing as the first shipment.
– Alisson Acioli
Put a
alert
in$("#searchfilters").on('click', function() {
and confirms to me if you’re calling.– Victor T.
Yes, you executed Alert
– Alisson Acioli
Check it out: http://jsbin.com/tesulebowo/edit?html,js,console,output
– Victor T.
If you also need to use the variable declared in
var mapplic
, also withdraw your statement from the function scope.– Victor T.
The Alert I put here and it also worked, but on the question of function
mapplic()
run again it seems that it does not run, does not update the div#mapplic– Alisson Acioli