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

Anam replied to Alyce Keegan's discussion Problems reverting to old site theme
"No response so far. I hope others are submitting tickets on this issue as it is platform wide."
2 hours ago
⚡JFarrow⌁ replied to Shelli Poole's discussion Facebook sign-in app gives a clue to Ning 2.1 coming?
"not sure i follow how this is an indicator of Ning 2.1  can you elaborate?  thanks"
8 hours ago
⚡JFarrow⌁ replied to Alyce Keegan's discussion Problems reverting to old site theme
"yes,,, the reversion back to a previous theme is a huge problem.  and there are others. forexample…"
8 hours ago
Fire-Tech replied to Alyce Keegan's discussion Problems reverting to old site theme
"I appreciate it. My biggest concern is reliability. I've heard that mixing up between different plu…"
9 hours ago
Shelli Poole replied to Shelli Poole's discussion Facebook sign-in app gives a clue to Ning 2.1 coming?
"Sighhhh no one cares. I'm secure."
11 hours ago
James Gatlin is now a member of USA NING CREATORS
12 hours ago
Just Asking replied to Alyce Keegan's discussion Problems reverting to old site theme
"I had to get addons from just about every company out there to make it do everything I wanted. and…"
yesterday
Fire-Tech replied to Alyce Keegan's discussion Problems reverting to old site theme
"Yeah, SE with all of the SEAO addons look to be best for me. I can handle the code part.. just hear…"
yesterday
CocteauBoy replied to CocteauBoy's discussion After Years of Enduring Empty Promises, I Am Leaving Ning
"Which links takes you to that? I don't get that warning for either link. I can only guess that the…"
yesterday
Jamie Baker replied to Nancy Gruver's discussion Migration from Ning to WordPress
"Hi Nancy,
I've migrated a few sites to Wordpress/Buddypress and strongly advise it. Fortunalty with…"
yesterday
Peter Denio, James Gatlin and CALIPSO joined Ning Creators Network
Tuesday
Anam replied to Alyce Keegan's discussion Problems reverting to old site theme
"I have been having this very issue for over a week. I put in a ticket, and included many other issu…"
Tuesday
Chazz replied to The Ning Team's discussion Notice of 2016 Storage Limit and Pricing Plan Changes
"I too have to admit that I am a customer who feels abused. Our Network Platform service continues t…"
Tuesday
Kos replied to Alyce Keegan's discussion Problems reverting to old site theme
"Ning definitely needs to 'clear' your back end it seems.  Filing a ticket on a Friday, you won't re…"
Tuesday
Katy Blagg replied to Katy Blagg's discussion Resizing Group Icons
"Thank you to all of you who have helped!!!
Just what I wanted. Thank you so much :)
Is working just…"
Tuesday
Kos replied to Nancy Gruver's discussion Migration from Ning to WordPress
"Alyce yes, Groups and their members migrate over.  Sadly no content does; they're empty but yes, th…"
Tuesday
Just Asking replied to Alyce Keegan's discussion Problems reverting to old site theme
"I think the two biggest contenders for alternatives are Jamroom and SocialEngine PHP, though some h…"
Tuesday
Alyce Keegan replied to Nancy Gruver's discussion Migration from Ning to WordPress
"Hello! Kos are you able to migrate groups? :( I have all of my classes listed as groups on my ning…"
Tuesday
Mandy replied to Nancy Gruver's discussion Migration from Ning to WordPress
"Hi Kos I'm in the same boat; would you mind sending me  PM with the link to check out as well! Than…"
Sunday
⚡JFarrow⌁ replied to ⚡JFarrow⌁'s discussion Tip: For Those Who Need a Personal Site
"no problem bud... definitely cool... one thing that distinguishes this from the rest is the ability…"
Sunday
More…