jqueryjquery-eventsjqtouch

jq touch id attar occurring twice


 $('#news_details').bind('pageAnimationEnd', function (e, info) {
          // get the id of the calling href
          //alert('we are here');
          var id = $(this).data('referrer')[0].id;
          //alert(id);
          $.get('http://localhost/school_app/admin/json/news_pagination.php?id=' + id, function (data) {
            // do something with the data
            //alert(data);
              $('#detail_news').append(data);
            //alert('we are here');
          });
        }); 

I am getting this id and passing it to the #news_details page, it is successfully but when I like the page the script occurs automatically by itself, and when I go to the #new_detail page with another id var the previous data is still there.

Please help me.


Solution

  • $('#news_details').bind('pageAnimationEnd', function (e, info) {
              // get the id of the calling href
              //alert('we are here');
              var id = $(this).data('referrer')[0].id;
              //alert(id);
              $.get('http://localhost/school_app/admin/json/news_pagination.php?id=' + id, function (data) {
                // do something with the data
                //alert(data);
                  $('#detail_news').html(data);
                //alert('we are here');
              });
            });
    

    Instead of using $('#detail_news').append(data);

    use $('#detail_news').html(data);

    it would work....