Jquery ajax loses connection after minutes

Is there a way to get jquery ajax to remain connected until the external execution of code is done?

Code:

$ .ajax({
        type: "POST",
        data: "pro=2",
        url:"engine/process.php", // huge data to be processed here
        error: function(){
              alert('error');
        },
        success: function(finish){
                //php code is complete
        }
});


the code works but after some few minutes it returns error alert when the connection is lost.
due to that the php code will not finish processing