How to load and then replace that content after specific time via ajax?

Anand Pilania

I have a problem with ajax :

Scenario is : onclick "triggre", load content from first div of "noti.html" via ajax into "#topNoti" and after that change/replace this loaded content after specific time with second div of "noti.html" and so on until the last div content is not loaded.

noti.html:
  `  ....
     <div id="inq">
     <div id="div1">This is first div</div>
     <div id="div2">This is second div</div>
     <div id="div3">This is third div</div>
     <div id="div4">This is fourth div</div>
    ...
     <div id="div24">This is last div</div>

     </div>
    ...

'

#topNoti:
    <div id="topNoti"></div>

Thanks and regards

Currently i used :

$(".trigger").click(function(){
var index=1;
$m=$("#inq").find("div"+index);
setInterval(function(){
$("#topNoti").load("noti.html",$m);
index=index+1;
If(index==25){ index=1; }
},10000);
});

But this code load all div. can anyone give me solution to load "div" one by one

I just modify my script n with this i can do what i want. Code is:

 Var index=0;
 SetInterval(function(){
 $("#topNoti").load("noti.html #div"+index);
 index=index+1;
 If(index==25){index=0;}
 },2000);

So, can anyone improve this code...

Thanks n regards

Rajesh Kumar

Use following code:

http://jsfiddle.net/GbQzh/

var index = 0;
var count=$("#topNoti div").length;
$("#topNoti div").hide().eq(index).show();
setInterval(function() {
     $("#topNoti div").hide().eq(index).show();
     index = index + 1;           
     if (index == count) {
         index = 0;
      }
}, 1000);

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to load AngularJS content via jQueryUI AJAX?

From Dev

Load specific html content via AJAX from a page that is loaded via ajax

From Java

Bootstrap 3 - How to load content in modal body via AJAX?

From Dev

How to load content via AJAX in a Twitter Bootstrap modal window?

From Dev

Wordpress load php content via AJAX

From Dev

How to Run Ajax request automatically after a specific time?

From Dev

How to replace content using AJAX

From Dev

How to load content using Ajax

From Dev

How to load content with ajax properly

From Dev

How to load file via ajax?

From Dev

Reinitialising content script after Ajax load?

From Dev

How to replace a html content with jsf reRender or ajax load, and rebind the new DOM with AngularJS?

From Dev

Extension to load a specific webpage after idle time

From Dev

How can I replace the entire HTML of a page, or its body content, via an AJAX call's success callback?

From Dev

How to load ajax after scroll?

From Dev

How to replace the content of a specific column with awk?

From Dev

How to load the datatable data via ajax?

From Dev

Make footer DIV stay bottom after AJAX content load

From Dev

How to load specific rows 100 at a time

From Dev

Execute code after loading content via ajax in foreach loop

From Dev

Bootstrap Datatable is no longer functioning after loading content via Ajax

From Dev

how to replace everything after specific word in php

From Dev

How to load specific fragment after click?

From Dev

How to remove content after a specific character or symbol

From Dev

Istotope ajax content load

From Dev

Ajax not being called the first time right after page load

From Dev

(ruby on rails)After an server data update, how to load/display a specific div from a partial in the quickest way with jquery/ajax?

From Dev

Load AJAX content for specific element (Pass DOM Element to AJAX callback function)

From Dev

How to load Admob ads after certain time of app load?

Related Related

  1. 1

    How to load AngularJS content via jQueryUI AJAX?

  2. 2

    Load specific html content via AJAX from a page that is loaded via ajax

  3. 3

    Bootstrap 3 - How to load content in modal body via AJAX?

  4. 4

    How to load content via AJAX in a Twitter Bootstrap modal window?

  5. 5

    Wordpress load php content via AJAX

  6. 6

    How to Run Ajax request automatically after a specific time?

  7. 7

    How to replace content using AJAX

  8. 8

    How to load content using Ajax

  9. 9

    How to load content with ajax properly

  10. 10

    How to load file via ajax?

  11. 11

    Reinitialising content script after Ajax load?

  12. 12

    How to replace a html content with jsf reRender or ajax load, and rebind the new DOM with AngularJS?

  13. 13

    Extension to load a specific webpage after idle time

  14. 14

    How can I replace the entire HTML of a page, or its body content, via an AJAX call's success callback?

  15. 15

    How to load ajax after scroll?

  16. 16

    How to replace the content of a specific column with awk?

  17. 17

    How to load the datatable data via ajax?

  18. 18

    Make footer DIV stay bottom after AJAX content load

  19. 19

    How to load specific rows 100 at a time

  20. 20

    Execute code after loading content via ajax in foreach loop

  21. 21

    Bootstrap Datatable is no longer functioning after loading content via Ajax

  22. 22

    how to replace everything after specific word in php

  23. 23

    How to load specific fragment after click?

  24. 24

    How to remove content after a specific character or symbol

  25. 25

    Istotope ajax content load

  26. 26

    Ajax not being called the first time right after page load

  27. 27

    (ruby on rails)After an server data update, how to load/display a specific div from a partial in the quickest way with jquery/ajax?

  28. 28

    Load AJAX content for specific element (Pass DOM Element to AJAX callback function)

  29. 29

    How to load Admob ads after certain time of app load?

HotTag

Archive