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

Luke Jones replied to Luke Jones's discussion a quick question
"Hey John :) Just a quick question, to see if you've possibly found that code yet ? :) Sorry to seem…"
4 hours ago
Luke Jones replied to George H. Compton IV's discussion Tip any network.. Graphical loader interface. Hide your ugly bounce rate.
"Hey George :) Hope your ok ? :) I told you the other day, that I wasn't going to use one of these a…"
4 hours ago
Luke Jones replied to Luke Jones's discussion Hopefully we'll have a music player and other stuff soon :)
"Ah right :) 
Well I've asked them for all of them, and they said their working on them and will rel…"
4 hours ago
Kos replied to Crystal Walters's discussion Member list bug
"and do not forget to do a "hard refresh" when viewing changes.  It bypasses what has been stored vi…"
23 hours ago
Strumelia replied to Luke Jones's discussion Hopefully we'll have a music player and other stuff soon :)
"I'm just about to add CometChat to my JamRoom network.  "
yesterday
Calico replied to Thiago Santos de Moraes's discussion Exemplos de comunidades inspiradoras usando o Ning 3.0 in Criadores Brasileiros - Brazilian Creators
"Perfect !!!!!
Consegui colocar o SKYSA mas eles cobram o Chat e a página fica um pouco pesada. Esto…"
yesterday
Calico replied to Thiago Santos de Moraes's discussion Exemplos de comunidades inspiradoras usando o Ning 3.0 in Criadores Brasileiros - Brazilian Creators
"OK"
yesterday
Luke Jones replied to Luke Jones's discussion Just a quick question
"I'm glad a Member to :)  Ah right :/ ,  Awesome, thank you :) aha ah right :)  Thank you :) best w…"
yesterday
Luke Jones replied to Luke Jones's discussion Another question :P
"Ye :) It's just all messy at the moment aha, It reminds me of myspace :P "
yesterday
Luke Jones replied to Luke Jones's discussion Another question :P
"Hm good point :) I hadn't thought about it aha"
yesterday
Luke Jones replied to Luke Jones's discussion please help ?
"Ah right :/ , ye I agree with you, it makes no sense at all, there's quite a few simple features th…"
yesterday
Luke Jones replied to George H. Compton IV's discussion Tip any network.. Graphical loader interface. Hide your ugly bounce rate.
"Ah right aha :) fair enough lolMy sister's boyfriend is called Matthew Compton see :P "
yesterday
ANGE.L LUAR left a comment for George H. Compton IV
"Acabei fechando  rede e abri outra espero que esta agora não de nada erado conheça participe..
http…"
yesterday
ANGE.L LUAR left a comment for ANGE.L LUAR
"Amigo Tiago  pus este 
https://www.spot.im/spots/new#create-top  
que vc me indicou estou fazendo t…"
yesterday
John Bizley replied to Crystal Walters's discussion Member list bug
"Hi Crystal, do you have a link to your site as this may help to see what the issue is. One thing th…"
yesterday
Thiago Santos de Moraes replied to Scott Orn's discussion Urgent - Ben's Friends Lupus Network is Down
"Scott, Ning answered you?"
yesterday
Thiago Santos de Moraes replied to marshall blake's discussion Ning Announcements
"Read this topic."
yesterday
Thiago Santos de Moraes replied to Thiago Santos de Moraes's discussion Exemplos de comunidades inspiradoras usando o Ning 3.0 in Criadores Brasileiros - Brazilian Creators
"Calico, eu coloquei o site numa caixa de HTML que já tem outras coisas na minha 3.0 e deu certo. Vo…"
yesterday
Thiago Santos de Moraes replied to Thiago Santos de Moraes's discussion Exemplos de comunidades inspiradoras usando o Ning 3.0 in Criadores Brasileiros - Brazilian Creators
"Calico, veja o que Zachary falou no final do tópico que indiquei sobre onde colocar o código na 3.0…"
yesterday
Calico replied to marshall blake's discussion Events For 3.0 Networks
"Robin B.
Thanks a lot !!!!!! Ill try both app !!! Youl be welcome to visit may page at http://reape…"
yesterday
More…