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 Social Network to add comments!

Join Ning Creators Social 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

⚡JFarrow⌁ replied to Fabricio Giugni's discussion Create a member Pro. What can he do that others can't?
"You could offer access to a group or set of pages that other members can't see..."
1 hour ago
Kevin Acosta replied to Kyryl_Ning_Support's discussion Chat Feature Update on Ning 3.0 is ready!
"FYI - some programming glitch is also affecting the old Ning 2.0 Pro sites . . . same "blank" regis…"
2 hours ago
Kevin Acosta replied to Marcelo Rodrigues's discussion Chat problem
"Apparently having the same issue here, including the timing as reported by site members while I was…"
2 hours ago
Kevin Acosta replied to Kyryl_Ning_Support's discussion Network not launched yet issue
"@ Kyryl - - thanks for these updates.  I was out of pocket traveling the past week, and several mem…"
3 hours ago
Tyler Durbin replied to Marcelo Rodrigues's discussion Chat problem
"My chat has been down for 2 days!  They are saying that it is a bug.  Ugggg...."
3 hours ago
Alex replied to Alex's discussion NING 3 Groups on Home Page
"Thank you John... works a treat.
Much obliged!
Alex"
3 hours ago
Manuel Adame Jimenez replied to Kyryl_Ning_Support's discussion Chat Feature Update on Ning 3.0 is ready!
"Patience Kos
{[°III ♤ ♡ ♧ III°]}"
3 hours ago
Bizz replied to Naveen Jain's discussion How can I disable Ning Search in 3.0
"Not sure, but will have to take a look to see if it's possible."
4 hours ago
Bizz replied to Alex's discussion NING 3 Groups on Home Page
"I would write this with this code below as it would keep the groups a nice size and not to small mu…"
4 hours ago
Ning via Facebook

#Ning #radio #online Tune in to the radio, find your playmates - and have fun on…

Mike Collins replied to Naveen Jain's discussion How can I disable Ning Search in 3.0
"John is there anyway of excluding the search in private groups through code?"
4 hours ago
Naveen Jain replied to Naveen Jain's discussion How can I disable Ning Search in 3.0
"This worked. Thanks"
5 hours ago
Naveen Jain replied to Naveen Jain's discussion How can I disable Ning Search in 3.0
"culytics.com"
5 hours ago
Bizz replied to Naveen Jain's discussion How can I disable Ning Search in 3.0
"Your most welcome :-)"
5 hours ago
Anam replied to Naveen Jain's discussion How can I disable Ning Search in 3.0
"Ahhh, I see! That makes sense. At least I eventually had the wit to think maybe it was my line of w…"
5 hours ago
Kos replied to Kyryl_Ning_Support's discussion Chat Feature Update on Ning 3.0 is ready!
"Day #3 and Chat is still down. This is ridiculous.  Please release "old" chat until you get things…"
5 hours ago
Bizz replied to Naveen Jain's discussion How can I disable Ning Search in 3.0
"No worries. If you want to make notes in css you must enclose them else it will stop all css from t…"
5 hours ago
Anam replied to Naveen Jain's discussion How can I disable Ning Search in 3.0

Hi John, I actually had tried it and it didn't work, but just gave it another try and it did. I a…"
5 hours ago
Bizz replied to Naveen Jain's discussion How can I disable Ning Search in 3.0
"Hi Anam, did you try my one as it should work, works on mine and I tried it on the creators one.
#x…"
6 hours ago
Anam replied to Naveen Jain's discussion How can I disable Ning Search in 3.0
"This didn't work for me. I also would like to remove the new search bar as it displays material in…"
7 hours ago
More…