Search code examples
javascriptjquerygsptaglib

Invoke a tag library on anchor link click event without form refresh?


I've a scenario where I've to make a call to Grails/ jsp taglib in order to get data and feed to the google charts. Here is my GSP code.

<a href="#empTab" onclick="initializeData();">

$(document).ready(function(){ initializeData()

function initializeData(){
    var chartsData = {}
   chartsData.frameDelayVariation = <emp:metrics name="${name}"  timeInterval="${timeInterval}" />
}
});

When I first come to the page,it invokes taglib and when I click on HREF link, the JS function get called but taglib not being invoked...

So is there any way that I could achieve this by Jquery without form submit?


Solution

  • Using ajax supported grails remoteLink tag to invoke a controller and reloading all the google charts script libraries onSuccess attribute so that all my google charts will be reloaded with the new Json Data.