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

George H. Compton IV replied to George H. Compton IV's discussion ( TIP N3 & N2 ) Chatwing fixed chatbox v4.2
"Thank you John :-) you have a wonderful evening"
2 minutes ago
George H. Compton IV replied to JFarrow's discussion Tip: How to Embed Flipboard Into Ning N3/N2
"This is cool thank you for sharing  JFarrow :-)"
3 minutes ago
Nelson Freytes replied to Nelson Freytes's discussion Using Ning 3 as a news publishing network
"Hi JFarrow,
Could you send me some sample sites? We'd be starting in early 2015, but I'd like to sh…"
1 hour ago
Fire-Tech replied to JFarrow's discussion Tip: How to Embed Flipboard Into Ning N3/N2
"+1. I have thought about this a few times. Will have to dig in. Thanks for sharing man."
1 hour ago
JFarrow replied to Nelson Freytes's discussion Using Ning 3 as a news publishing network
"Yes, Ning3 is a wonderful solution for this.  Combining the power of Ning with various 3rd party ap…"
2 hours ago
dave replied to George H. Compton IV's discussion ( TIP N3 & N2 ) Chatwing fixed chatbox v4.2
"This is terrific work George and looks fantastic, It's another great adaptation to the Ning 3 and 2…"
3 hours ago
Nan Cassidy, Chief Liberation, James A Hull and 4 more joined Ning Creators Network
3 hours ago
William Le Metayer is now a member of Ning Networks en español
3 hours ago
Zachary Moonshine replied to George H. Compton IV's discussion ( TIP N3 & N2 ) Chatwing fixed chatbox v4.2
"man this looks so great and works soo much better , spot.im had a good idea but they are still work…"
4 hours ago
JFarrow replied to JFarrow's discussion Tip: How to Embed Flipboard Into Ning N3/N2
"flipboard is pretty amazing for what it is and the ease of building magazines.. i hope you guys fin…"
5 hours ago
John Bizley replied to George H. Compton IV's discussion ( TIP N3 & N2 ) Chatwing fixed chatbox v4.2
"Nice work as always George, been following this post as you have been working on it and it looks gr…"
5 hours ago
Kos replied to JFarrow's discussion Tip: How to Embed Flipboard Into Ning N3/N2
"We were just looking at Flipboard last week.  Awesome.  Thank you!"
6 hours ago
George H. Compton IV replied to George H. Compton IV's discussion ( TIP N3 & N2 ) Chatwing fixed chatbox v4.2
"Hello Zachary, The code in this discussion has just been updated V4.2 and I also have the button yo…"
6 hours ago
George H. Compton IV replied to George H. Compton IV's discussion ( TIP N3 & N2 ) Chatwing fixed chatbox v4.2
":-) Thank you The Builder :)"
6 hours ago
JFarrow replied to JFarrow's discussion Tip: How to Embed Flipboard Into Ning N3/N2
"Thank you John... was a real treat to get it working"
7 hours ago
Kerrie replied to Kerrie's discussion Help I can’t access my network or blogs
"lol..blame it on solar flares! I just received this...
Hi Kerrie,
Thanks for getting in touch with…"
7 hours ago
John Bizley replied to JFarrow's discussion Tip: How to Embed Flipboard Into Ning N3/N2
"Thats a sweet share JF, nice work my friend. :-)"
7 hours ago
JFarrow replied to Alyce Keegan's discussion Hiding members in a group on group information
7 hours ago
MILAGROS HERNÁNDEZ CHILIBERTI replied to Kerrie's discussion Help I can’t access my network or blogs
10 hours ago
Luke Jones replied to Luke Jones's discussion Developer Needed in Hire a Creator
"I need your help dude :) I need a notification/alert icon/button created to place by the side of my…"
11 hours ago
More…