0

I have an page with images.

if the user is at the end of the page there will be more content loaded so the content extends if the user is at the end and can keep on reading.

My problem is that when i get the content wich is.

  <a data-role="button" data-theme="b" href="/ref">
        Title
  </a>

The html looks correct but it dosnt get the style for buttons. it gets no style.

It looks like a old link (blue underlined)

i use :

var url = "more.php?p=" + nextpage;

$.post(url, function (data) {

    $('#all').children().last().after(data);
    alreadyloading = false;
    nextpage++;
});

to load the content in div #all

but i found that the style is changed cause i have added

  id="all"

to

  <div data-role="content" >

but i need to have a div id to load the script more.php how can i do this? So i want to keep the style but load content in the div.

if i remove id="all" and paste the html in the div:

like

 <div data-role="content" >

 <a data-role="button" data-theme="b" href="link.php?id=26" data-corners="true" data-shadow="true" data-iconshadow="true" data-wrapperels="span" class="ui-btn ui-btn-up-b ui-shadow ui-btn-corner-all"><span class="ui-btn-inner ui-btn-corner-all">

 <span class="ui-btn-text">
 Title</span></span></a>

it works.

but

 <div data-role="content" **id="all"** >

 <a data-role="button" data-theme="b" href="link.php?id=26" data-corners="true" data-shadow="true" data-iconshadow="true" data-wrapperels="span" class="ui-btn ui-btn-up-b ui-shadow ui-btn-corner-all">

 <span class="ui-btn-inner ui-btn-corner-all">

 <span class="ui-btn-text">

 Title</span></span></a>

wont work

SO my problem is how can i import data while keeping the button style.

1
  • Create a new div under content div with id=all. <div data-role="content"><div id="all"></div></div> Commented Mar 28, 2013 at 15:26

1 Answer 1

1

You can trigger the create event on your container element when the new markup has been loaded:

$("#all").load("more.php?p=0", function() {
    $(this).trigger("create");
});

EDIT: The same strategy applies if you use $.post() instead of load():

$.post(url, function(data) {
    $("#all").append(data).trigger("create");
    alreadyloading = false;
    nextpage++;
});
Sign up to request clarification or add additional context in comments.

1 Comment

my bad i posted load insted of post

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.