0

I have a news app which displays headlines on the index page and on click of a link "load more it loads more headline".I updgrade my jquery mobile version from 1.8.3 to 1.11.1 and the "load more" link fails to load more headlines

$(function() {
//More Button
$('.more').live("click",function() 
{
var head_id = $(this).attr("id");
if(head_id)
{
$("#more"+head_idu_pic_id).html('<img src="photo_loader.GIF" />');

$.ajax({
type: "POST",
url: "moreheadlines.php",
data: "lastmsg="+ head_id, 
cache: false,
success: function(html){
$("ol#updates").append(html);
$("#more"+head_id).remove();
}
});
}
else
{
$(".morebox").html('The End');

}


return false;


});
});

this is the currently jquery version i'm using

<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
i_user
  • 511
  • 1
  • 4
  • 21

2 Answers2

1

if, by chance, your "id" updates/changes, current versions of jQuery will not use any updated values set to your attribute. Another thing to keep in mind is that attributes can only be strings while properties can be any type.

To avoid this issue use .prop() instead of .attr(). I recommend reading more about it at the link provided.

Community
  • 1
  • 1
0

Check after modifying this statement

$("ol#updates").append(html);

to

$("#updates").append("<li>" + html + "</li>");

HTML code should be:

<ol id="updates"></ol>

waders group
  • 538
  • 3
  • 7