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

Bizz ( John ) replied to Pat Howlett's discussion talkfunnels.com is Live!
"Hi Pat, nice to see you back. I also came back onto Ning a few months ago once I found out that Mod…"
7 hours ago
Thisisbully replied to Saurabh's discussion Has any one created android ios mobile app ning 3.0
"The guys on here are older than computers lol they do not work on anything mobile on here ,the day…"
12 hours ago
Saurabh replied to Saurabh's discussion Has any one created android ios mobile app ning 3.0
"no one ?"
19 hours ago
Dr. Krishna Kumari Challa replied to Dr. Krishna Kumari Challa's discussion Now I cannot save anything on my network!
"Infact the 'save button is not even reacting when you click on it most of the times! The problem st…"
yesterday
Dr. Krishna Kumari Challa replied to Dr. Krishna Kumari Challa's discussion Now I cannot save anything on my network!
"Yes, I got this reply from you...
Thanks for contacting us.
We have tested the network and especial…"
yesterday
Bizz ( John ) replied to Martin Buzz's discussion Can I limit number of Photos uploaded?
"Hi Martin, do you mean in total or just the amount being uploaded at one time ?"
yesterday
Bizz ( John ) replied to Bizz ( John )'s discussion Why Are The Events Not Listing The Same Way As UpComing In My Events Or Categories ?
"Thanks for the reply Kyrl, I think this is a priority to do as  the way it stands at the moment if…"
yesterday
Kos replied to FedMedic's discussion Members only page is seen by everyone
"We had over 17,000 posts, not including comments.  No way!  lol"
yesterday
Kos replied to Martin Buzz's discussion Can I limit number of Photos uploaded?
"I'm sure there's a way, although I can't say that I've seen it.  If you can't locate it with a sear…"
yesterday
FedMedic replied to FedMedic's discussion Members only page is seen by everyone
"Agreed, it would be hard to leave it behind, however, I could leave it up to our members to manuall…"
yesterday
Kos replied to FedMedic's discussion Members only page is seen by everyone
"The big problem is leaving so much data behind.  Not all the json files function on export so you w…"
yesterday
FedMedic replied to FedMedic's discussion Members only page is seen by everyone
"Yeah, that's what I thought and I agree with you. That canned "cache" excuse is wearing a tad thin.…"
yesterday
Kos replied to FedMedic's discussion Members only page is seen by everyone
"Yes, it's displaying.  Tell Ning to drop the canned 'cache' excuse and get off their backside.  You…"
yesterday
Pat Howlett replied to medicsindex's discussion Ning Wants old Members Back !!! and ,,
"Well it worked on me :]
Saw that new ownership had arrived, saw them taking responsibility for wher…"
yesterday
Pat Howlett replied to Pat Howlett's discussion talkfunnels.com is Live!
"Gota share how fun it is again to be building a community of like minded folk -  I've missed it gre…"
yesterday
Kyryl_Ning_Support replied to Dr. Krishna Kumari Challa's discussion Now I cannot save anything on my network!
"Hi there,
Please check your email address, we have sent the reply on your ticket.
And apologies for…"
yesterday
Kyryl_Ning_Support replied to Bizz ( John )'s discussion Why Are The Events Not Listing The Same Way As UpComing In My Events Or Categories ?
"Hi John,
The task to change the logic of event appearing has been already created however as curren…"
yesterday
Kyryl_Ning_Support replied to Yana Ning Support's discussion CAPTCHA - NO BOTS AND SPAMMY CONTENT
"Hi there,
It seems that for some reason domain blockage hasn't worked out for that user specificall…"
yesterday
Kyryl_Ning_Support replied to Lisa's discussion WHOLE SITE COMPLETELY VANISHED PLEASE HELP - URGENT RESPONSE NEEDED
"Hi Lisa,
Sorry but unfortunately, we don't know why exactly the domain mapping has stopped working…"
yesterday
Howard Sands replied to Bryce Rubio's discussion A Follow-Up Message from our CEO
"Agreed. I hope the idea gets some traction. "
Thursday
More…