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

SweetPotato replied to Scott Bishop's discussion Make Any Page Into an RSS Page
1 hour ago
dave replied to George H. Compton IV's discussion (Ning 2 & 3) welcome / sign-in and sign-up pop-up module. Updated May 1, 2016
"Awesome work George :-) Great update thank you for sharing."
7 hours ago
George H. Compton IV replied to George H. Compton IV's discussion Ning coding and styling Tool "GeocPlugin" v2.00.005
"Update May 2, 2016
NEW Feature, Run a script every 15, 30, 45 or 60 seconds. Target just online mem…"
14 hours ago
steve davies replied to Traddie's discussion Can't Sign in or out of my Network, or add blogs
"Are many of you pasting from MS Word into Ning?
Had an issue with some work I did years ago. Turned…"
yesterday
steve davies replied to Traddie's discussion Can't Sign in or out of my Network, or add blogs
"Here is my update from the other convo - Steve D, Canberra
UPDATE: Ning contacted me quite quickly.…"
yesterday
steve davies replied to steve davies's discussion Can't sign out of my site etc
"UPDATE: Ning contacted me quite quickly. Said that they had cleaned up some 'stuff' at their end. T…"
yesterday
Garfield Archivist replied to steve davies's discussion Can't sign out of my site etc
"I think you missed the part where Steve said they don't care. If you don't pay they will cancel you…"
yesterday
Kos replied to Seth Regan's discussion Network down... AGAIN?!?!?!??!
"Seth you do realize you're preaching to choir here b/c Ning is not involved in the forums..........…"
yesterday
Kos replied to Seth Regan's discussion Migration from a broken 2.0 to 3.0
"1.  I lost no content and all my members made it ro 3.0 just fine.
2.  Yes some things are missing…"
yesterday
Seth Regan replied to steve davies's discussion Can't sign out of my site etc
"I'm not paying anymore till it's fixed."
yesterday
Seth Regan replied to Seth Regan's discussion Network down... AGAIN?!?!?!??!
"I'm just gonna keep making a big stink about it.... cuz well... it STINKS!"
yesterday
Just Asking replied to Seth Regan's discussion Network down... AGAIN?!?!?!??!
"Yeah, I have said the same thing on the FB page. One of my competitors was closing and I was poised…"
yesterday
Steve C replied to steve davies's discussion Can't sign out of my site etc
"We're paying for a service that doesn't care."
yesterday
Seth Regan replied to Seth Regan's discussion Network down... AGAIN?!?!?!??!
"Oh and now they wanna raise prices?!?!?!"
yesterday
Seth Regan replied to Seth Regan's discussion Network down... AGAIN?!?!?!??!
"I've lost more than that... I've lost MEMBERS which I've worked very hard to get to join. I've lost…"
yesterday
Just Asking replied to Seth Regan's discussion Migration from a broken 2.0 to 3.0
"3.0 is still missing a lot of features. They never finished developing it. :/ This doesn't answer y…"
yesterday
Seth Regan replied to The Ning Team's discussion Notice of 2016 Storage Limit and Pricing Plan Changes
"You're raising pricing while 2.0 hasn't even been working right for weeks???? Are you insane?
Get m…"
yesterday
Seth Regan replied to Crystal's discussion It's Time - Creators 3.0 Launches Wednesday - UPDATE - It's LIVE!
"Are you going to finally fix 2.0? My network is STILL having 500 Error issues."
yesterday
Seth Regan replied to steve davies's discussion Can't sign out of my site etc
"Are we to ask all of our members to "try a different browser"? NO! This should just WORK! It's utte…"
yesterday
Just Asking replied to Seth Regan's discussion Network down... AGAIN?!?!?!??!
"*Like* *Like* *Like* *Like* *Like* 
Ditto that. I've lost more than a week because of these errors,…"
yesterday
More…