How to Run Ajax request automatically after a specific time?

user5756014

I have an Ajax function (ajaxRequest) that I want to run automatically after some specific time (say 5 sec) without any user-prompt or warning . How can i do this? (I looked in the following links but found no solution )

jQuery: How to make an AJAX request and continue without waiting for request to complete?

How do I run ajax request in background continuously?

How to run ajax call in background after some particulate time?

How to run execute page in background using ajax?

//My Code
//ajaxRequest Script..

<script type="text/javascript">
function ajaxRequest(map){

var xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", 'json_data.php', true);

xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
    var myArr = JSON.parse(xmlhttp.responseText);
    setMarkers(map,myArr);
}
};
xmlhttp.send(null);
}
</script>

<script>
function myMap() {
var mapCanvas = document.getElementById("map");
var myCenter = new google.maps.LatLng(51.508742,-0.120850);
var lat=51.508742;
var lng=-0.140850;
var mapOptions = {center: myCenter, zoom: 5};
var map = new google.maps.Map(mapCanvas,mapOptions);

ajaxRequest(map);                                   //Called ajaxRequest

}
</script>
Jaydip Bhingradiya

Hello this is solution for the automatically send the ajax request

Just put your function like this.

function myMap() {
var mapCanvas = document.getElementById("map");
var myCenter = new google.maps.LatLng(51.508742,-0.120850);
var lat=51.508742;
var lng=-0.140850;
var mapOptions = {center: myCenter, zoom: 5};
var map = new google.maps.Map(mapCanvas,mapOptions);                     
setInterval(function()
    {
      ajaxRequest(map);
    }, 5000);
}

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 run a method after a specific time interval?

From Dev

How to make kivy window close automatically after specific amount of time?

From Dev

How can I automatically shutdown the system after a specific time?

From Dev

How to run a function after specific time then switch it off after specific time?

From Dev

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

From Dev

How to cancel an ajax request or third party js request when no response after x time w/ abort()

From Dev

How can i trigger this jquery script to automatically run after a set amount of time (5 seconds maybe)?

From Dev

automatically run script on successful time sync - how?

From Dev

How to automatically run a command after saving a file

From Dev

How to run a command automatically after each reboot

From Dev

How to automatically run a command after exiting ssh

From Dev

URL gets appended with $_GET-parameters automatically after AJAX request

From Dev

Automatically close magnific Popup iframe after ajax request result

From Dev

How to run CLLocationManager in a specific period of time

From Dev

How to run a function at specific time & date?

From Dev

How to schedule tcpdump to run for a specific period of time?

From Dev

How to run a function at a specific time in iOS?

From Dev

how to run a thread for a specific time in android studio

From Dev

How to run ubuntu command on specific time

From Dev

jQuery run function after $.each ajax request has completed

From Dev

React - How to Update State After AJAX Request

From Dev

How to transition routes after an ajax request in redux

From Dev

How to delete file after access it with ajax request?

From Dev

how to stop ajax request after type:Post

From Dev

How to refresh div after AJAX request in MVC?

From Dev

run a msql query after a specific amount of time without user interaction?

From Dev

Cpanel - setup cron job to run after a specific time

From Dev

How to run Specific function automatically or infinite times in Python Tkinter?

From Dev

How to automatically run a specific command on Live USB on boot?

Related Related

  1. 1

    How to run a method after a specific time interval?

  2. 2

    How to make kivy window close automatically after specific amount of time?

  3. 3

    How can I automatically shutdown the system after a specific time?

  4. 4

    How to run a function after specific time then switch it off after specific time?

  5. 5

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

  6. 6

    How to cancel an ajax request or third party js request when no response after x time w/ abort()

  7. 7

    How can i trigger this jquery script to automatically run after a set amount of time (5 seconds maybe)?

  8. 8

    automatically run script on successful time sync - how?

  9. 9

    How to automatically run a command after saving a file

  10. 10

    How to run a command automatically after each reboot

  11. 11

    How to automatically run a command after exiting ssh

  12. 12

    URL gets appended with $_GET-parameters automatically after AJAX request

  13. 13

    Automatically close magnific Popup iframe after ajax request result

  14. 14

    How to run CLLocationManager in a specific period of time

  15. 15

    How to run a function at specific time & date?

  16. 16

    How to schedule tcpdump to run for a specific period of time?

  17. 17

    How to run a function at a specific time in iOS?

  18. 18

    how to run a thread for a specific time in android studio

  19. 19

    How to run ubuntu command on specific time

  20. 20

    jQuery run function after $.each ajax request has completed

  21. 21

    React - How to Update State After AJAX Request

  22. 22

    How to transition routes after an ajax request in redux

  23. 23

    How to delete file after access it with ajax request?

  24. 24

    how to stop ajax request after type:Post

  25. 25

    How to refresh div after AJAX request in MVC?

  26. 26

    run a msql query after a specific amount of time without user interaction?

  27. 27

    Cpanel - setup cron job to run after a specific time

  28. 28

    How to run Specific function automatically or infinite times in Python Tkinter?

  29. 29

    How to automatically run a specific command on Live USB on boot?

HotTag

Archive