jquery - How to display JSON data according to URL parameter(year) passing (if it is 2015, 2015 data only should display not 2016 data)) -


i creating hybrid application using intel xdk , using jquery mobile ui, trying display json data label, first let me tell ui design how need. have 2 buttons (increment, decrement) in between these 2 buttons have 1 label. ex: let consider set label value "2015"(current year), if click increment button value increasing 2016,2017 , on. same decrement button if click values go 2014,2013 , on. header ui design ok, let me come content side, in content side going display json data url according above year displaying ex: suppose 2015 there in label, have display 2015 data("sports day" refer below(message)json) content div tag. if increment 2016 using increment button, have display 2016 data("culturals" refer below(message)json) same content page , should not display previous value data(2015 data). attached requirement images how need check these 2 links

https://drive.google.com/file/d/0b9rwnanuuwndqlg5aviwsklax3m/view

https://drive.google.com/file/d/0b9rwnanuuwndatktttr4egdree0/view

this url json data(2015 data)

{   "circular":       [           {            "id":"9",            "year":"2015",            "date":"2015-04-17",            "message":"sports day",            "timestamp":"2015-04-18 19:14:24",          },       ] }   

this url json data(2016 data)

  {   "circular":       [           {            "id":"10",            "year":"2016",            "date":"2015-04-17",            "message":"culturals",            "timestamp":"2015-04-18 19:14:24",          },       ] }   

now getting data in same page means 2015 data , 2016 data showing in same page while clicking increment button. want display 2016 data separately not including 2015 data. using mustache concept display json data

//this function getting json data url   $.fn.myfunction = function() {       $.getjson(url,  function(data){         (var i=0, len=data.circular.length; < len; i++) {             output = data.circular[i];              alert(output.message);         }              //this displaying json data                    var template =$('#sharestemplate').html();              //data.circular json data               var html = mustache.to_html(template,data.circular);               $('#samplearea1').append(html).appendto(this);             });       }  

this mustache code displaying json data dynamically

       <div id="samplearea1"></div>         <script id="sharestemplate" type="text/template">              {{#.}}              <h1>{{message}}</h1>              {{/.}}          </script>  


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -