Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6208875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:52:56+00:00 2026-05-24T05:52:56+00:00

i have one jquery function which i need to work in following way 1.

  • 0

i have one jquery function which i need to work in following way

1. call a php file
2. log the values return by php file
3. have time delay
      again repeat the above process for number of time

for this purpose i write bellow jquery and php file

<script type="text/javascript">
$(document).ready(function() {
listsValues="1,10,20";
n=0;
msgids = listsValues.split(',');
$.each(msgids, function() {
html="TEST MESSAGE";
 n++;
setTimeout(function() {
$.ajax({
                type: "POST",
                url: "test1.php",
                cache:false,
                data:"id="+ msgids[n],
                dataType:'json',
                success: function(json)
                {
                var foo = json.foo;
                uemail = foo.split(',');
                console.log(uemail)
                }
            });
 }, 1000);

 });

  });
</script> 

and here is test1.php

<?php
$id=$_POST['id'];

$val="";
for($i=1;$i<=$id;$i++) { 

$val.=$i;

}

$return["foo"] =$val;

print stripslashes(json_encode($return));

?>

but this is not working as a way i want, when i execute this script
i can see in firebug test1.php file executes (called) for 3times and after that values are written in console

as i said waht i want was
1. execute test1.php file
2. write value in console
3. give delay

then repeat

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T05:52:56+00:00Added an answer on May 24, 2026 at 5:52 am

    I think you are searching something like this:

    <script type="text/javascript">
    function request(n) {
        $.ajax({
            type: "POST",
            url: "test1.php",
            cache:false,
            data:"id="+ msgids[n],
            dataType:'json',
            success: function(json)
            {
                var foo = json.foo;
                var uemail = foo.split(',');
                console.log(uemail);
                setTimeout(
                    function() { 
                        request(n);
                    }
                    , 1000
                );
            }
        });
    }
    
    $(document).ready(function() {
        var listsValues="1,10,20";
        var n=0;
        var msgids = listsValues.split(',');
        $.each(msgids, function() {
            var html="TEST MESSAGE";
            n++;
            request(n);
        });
    });
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a file called function.js which has all my jQuery for my aplication
I have multiple divs like setted up below. I want 1 (one) JQuery function
I have the following JQuery code: jQuery(function($) { $j(.follow_btn) .click( function() { var element
Is it possible to have one jQuery ready block executed after all others have
I am using SimpleModal in jQuery, and I have one confirm dialog. If the
Ok, so here's what I want to do, preferably with jQuery 1.4.2: Have one
Does jQuery - or one of it's plugins - have equivalent functionality to the
I have two scripts running on the same page, one is the jQuery.hSlides.js script
I have been working with the jQuery Grid the past few days and one
I have created an interface using jQuery UI Tabs, however one of my requirements

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.