how to retrieve data from database based on postition in phonegap?

how to retrieve data from database based on postition in phonegap?

I'm displaying the alphabets in a grid view,whenever i click on each alphabet it has to display the corresponding words of that alphabet,for that i could able to get the position of each alphabet,so how can i retrieve or pass the data from database?

here is the screenshot of that



Copy code
  1. var a2zArray =['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'];

    $(document).ready(function()
    {
        createA2ZGrid
    ();
    });


    function createA2ZGrid(){
    var rowElem='';


    for (var i=0; i < a2zArray.length; i++){
        rowElem
    = rowElem +" "+ "<label id='elementId' onclick=onClicked('"+a2zArray[i]+"')>" + a2zArray[i] + "</label>";


    }
             $
    ("#A2Z-GridId").html(rowElem);
    }


    function onClicked(element){
    alert
    ("Onclicked : "+element);


    };