Current status of the Ning Platform is always available on the Ning Status Blog.

Forum

Can you complete this code?

Hello Creators, I have a little challenge for those of you who know how to use the javascript language!

This is a code that apparently reloads only part of the page... anything that has an id. So, I have content on my network, ready to be refreshed every 5 minutes. I have wrapped my content in a <DIV>

this is how I did that...

<div id="#partialreload">

my content...

</div>

so, as far as I know, the content ready to be refreshed is now named with an id of #partialreload.

right?

So, here is the code that I am talking about, that should autorefresh the <DIV> that I have named, #partialreload.

its not working, I'm not really sure what I'm doing wrong. Can somebody offer a little bit of direction with this feature?

Thank you kindly!

Here's the codes...

$('#button1').click(function() 
{ var url = "http:www.your-url.com?ID=" + Math.random();
//create random number
setTimeout(function() { $("#elementName").load(url+" #elementName>*","");
}, 1000);

//wait one second to run function });

You need to be a member of Ning Creators Network to add comments!

Join Ning Creators Network

Email me when people reply –

Replies

  • What I do is put the part of your page that you want refreshed every few seconds on it's own page of a separate server. Then place this code below into the head of that page.

    I then iframe that page onto the whichever page you want.

    btw- I'm not a coder but I copy & paste well. Somebody I'm sure has a cleaner code:

    <script>
    <!--

    /*
    Auto Refresh Page with Time script
    By JavaScript Kit (javascriptkit.com)
    Over 200+ free scripts here!
    */

    //enter refresh time in "minutes:seconds" Minutes should range from 0 to inifinity. Seconds should range from 0 to 59
    var limit="0:02"

    if (document.images){
    var parselimit=limit.split(":")
    parselimit=parselimit[0]*60+parselimit[1]*1
    }
    function beginrefresh(){
    if (!document.images)
    return
    if (parselimit==1)
    window.location.reload()
    else{
    parselimit-=1
    curmin=Math.floor(parselimit/60)
    cursec=parselimit%60
    if (curmin!=0)
    curtime=curmin+" minutes and "+cursec+" seconds left until page refresh!"
    else
    curtime=cursec+" seconds left until page refresh!"
    window.status=curtime
    setTimeout("beginrefresh()",1000)
    }
    }

    window.onload=beginrefresh
    //-->
    </script>

    • Very interesting. I'm reading your code here, seems like that would do the trick... where would I put in my #partialreload <DIV> declaration though? That's the question. I wrapped the content I want to reload in a <DIV> called #partialreload.

      • I don't know the coding. Found it doing a google search, copied & pasted it.

        Make a new blank page using a different server, placed the html of the content you want to be refreshed every 2 seconds within the body tags then place that script in the head tag. Then give the page a name: /example-page.html

        Then go to the page you want the the content to be, and at the location of where you want it make an iframe <iframe src="/example-page.html" width="100%" height="135" scrolling="no" frameborder="0"></iframe> (adjust the height & width accordingly)

        • Oh also, if you have links in the content of your /example-page.html you'll want to target them with _parent.

  • NC for Hire

    Hi,

    first of all you cannot put # inside the ID tag of html.

    <div id="#partialreload"></div>

    Is ##partialreload

    Use this:

    <div id="partialreload"></div>

     

    While for the script:

    <script type="text/javascript">

    window.onload = refresher;

    function refresher(){
    setTimeout('refreshdiv();',300000);//refresh every 5 minutes , 5min =300000 milliseconds
    }
    function refreshdiv(){

    var url = "http://yoururl?id=" + Math.random();

    x$('#partialreload').load(url +" #elementname");

    }

    </script>

This reply was deleted.

Search the Creators Network

Latest Activity

Strumelia replied to Steve C's discussion Alternative to Photo Albums Needed
"TJ, does your album feature you describe allow network members to all create their own photo albums…"
3 hours ago
Kos replied to Kos's discussion Forums have DISAPPEARED!
"Simon did you check the ticket itself in the Support area of your website?  Yes, no response…"
3 hours ago
Anant Garg replied to Mary Jane Peterson's discussion CometChat
"We have a free trial. So you can try it for 15-days and if you are satisfied, continue to use it on…"
8 hours ago
Zachary Moonshine replied to Mary Jane Peterson's discussion CometChat
"yes i went to this site , but there is very little info about what it is and what is available i…"
8 hours ago
Anant Garg replied to Mary Jane Peterson's discussion CometChat
"CometChat for Ning is different from our CometChat self-hosted solution. CometChat self-hosted…"
8 hours ago
Zachary Moonshine replied to Mary Jane Peterson's discussion CometChat
"When i first started researching Cometchat i noticed a website where i can buy this for a one time…"
8 hours ago
Anant Garg replied to Mary Jane Peterson's discussion CometChat
"We have not yet released this feature for Ning. We are releasing it shortly. It works as follows: -…"
8 hours ago
Zachary Moonshine replied to Mary Jane Peterson's discussion CometChat
"Then how does facebook and google integration work ? They must be members as well, it will not just…"
8 hours ago
Anant Garg replied to Mary Jane Peterson's discussion CometChat
"CometChat is meant for your site users only. Not for all guests etc. A user who logs into your site…"
9 hours ago
Jeroen Beelen replied to Jeroen Beelen's discussion Email notifications (how do member stay up to date - even without being logged-in?)
"Hi Anam, that does not sound right. These basic features should work."
9 hours ago
TJ @ jQueryHelp replied to Ning's discussion Update to Product Roadmap and Communication Changes
"Hi Deborah, Welcome to the forum!  I visited your site, very nice.  I saw some awesome…"
9 hours ago
TJ @ jQueryHelp replied to Steve C's discussion Alternative to Photo Albums Needed
"Hi Jeff, From what I've read, Ning has made it clear that there will be no Photo Albums in…"
10 hours ago
Simon Farnworth replied to Kos's discussion Forums have DISAPPEARED!
"Unfortunately I haven't had a reply from Support in days... I emailed them again and still…"
12 hours ago
Zachary Moonshine replied to Mary Jane Peterson's discussion CometChat
"Ok so only members can access it, what about people on facebook or google ? does it not have a…"
15 hours ago
jeff uhlik replied to Steve C's discussion Alternative to Photo Albums Needed
"I'm a little late to this thread (I teach college and on summer break) but HELLO NING... the…"
16 hours ago
John Bizley replied to John Bizley's discussion My New Splash Screen Utilizing the Ning bar links
"Playing around with some settings at the moment so if you visit the splash page it may look a…"
17 hours ago
Strumelia replied to Kos's discussion Forums have DISAPPEARED!
"I really do sympathize.  I know how upset I would be if it were happening to me.  :("
20 hours ago
Kos replied to Kos's discussion Forums have DISAPPEARED!
"Good to know it's not platform wide.  Thank you Strumelia."
20 hours ago
Strumelia replied to Kos's discussion Forums have DISAPPEARED!
"Kos, I am not experiencing any of this forum issue in my 2.0 today (or ever actually).   …"
21 hours ago
John Bizley replied to John Bizley's discussion My New Splash Screen Utilizing the Ning bar links
"Thanks everyone, I will add all the code although it really is not very much, but first I have to…"
21 hours ago