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 7594553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:26:46+00:00 2026-05-30T21:26:46+00:00

I have Jquery+Ajax page that connects to server gets some data, and displays it.

  • 0

I have Jquery+Ajax page that connects to server gets some data, and displays it. This is done all the time, function calls itself after it completes all task and starts to perform again and again. But If komputer loses internet connection everything stops. And when connections comes back again, nothing happens. Here is javascript code. How can I iprove it so it will continue to work after connection is back again.

$(document).ready(function() {
var a=1;
var max='23';

function kiosk() 
{
    if(a<max) 
    {
        $.post('engine.php', { index: a },
        function(result) 
        {
            result = jQuery.parseJSON(result);

            $('#main').css({'display':'none'});


            $('#div_city').html(result.dest);
            $('#div_price').html(result.price);
            $('#div_price_pre').html('From&nbsp;');
            $('#div_price_after').html('&nbsp;Euro');

                $('#main').fadeIn(2000).delay(3000).fadeOut(2000, function() 
                    {

                            $('#main').hide;
                            a++;
                            kiosk();


                    });

        });
    }
    else
    {
        a=1;
        kiosk();
    }

}
kiosk();
});
  • 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-30T21:26:47+00:00Added an answer on May 30, 2026 at 9:26 pm

    I would suggest rather than using $.post you use

    $.ajax({ type: “post” , success : function1() , failure: function2() }.

    In function2() you can call koisk again after a timeout. and the succces would be the function you have created right now.

    This link will help you understand the ajax function jQuery Ajax error handling, show custom exception messages

    Eg Code snippet:

    function kiosk() 
    {
    if(a<max) 
    {
        $.ajax({type : "POST" , url : 'engine.php',data: { index: a },
        success : function(result) 
        {
            result = jQuery.parseJSON(result);
    
            $('#main').css({'display':'none'});
    
    
            $('#div_city').html(result.dest);
            $('#div_price').html(result.price);
            $('#div_price_pre').html('From&nbsp;');
            $('#div_price_after').html('&nbsp;Euro');
    
                $('#main').fadeIn(2000).delay(3000).fadeOut(2000, function() 
                    {
    
                            $('#main').hide;
                            a++;
                            kiosk();
    
    
                    });
    
        },error : function (xhr, ajaxOptions, thrownError){ setTimeout(200,kiosk())  }
    
        });
    }
    else
    {
        a=1;
        kiosk();
    }
    

    }
    kiosk();
    });`

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have jQuery Ajax request that sends data to a PHP page that then
I have multiple ajax forms on page that cointain same elemets, I have jquery
I have a web page that uses jquery ajax to grab the table markup
I am simply learing Ajax with jQuery and have a simple page method that
On my main page I have this jquery code which does an ajax call
I have this jQuery script var dataString = class_id=+class_id; $.ajax({ type: POST, url: page.php,
I have a jQuery AJAX call with type:'GET' like this: $.ajax({type:'GET',url:'/createUser',data:userId=12345&userName=test, success:function(data){ alert('successful'); }
I have a jquery-ajax function that sends data to a php script and the
I am new to jQuery / AJAX. I have a page that uses colorbox
Quick question: I'm using jquery ajax to call a page that returns some json

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.