Ajax progress bar using example module
Progress bar example:

$form['submit'] = array(
    '#type' =&gt; 'submit',
    '#value' =&gt; t('Import'),
    '#ajax' =&gt; array(
        'callback' =&gt; 'import_submit_callback',
        'wrapper' =&gt; 'import-form',
        'progress' =&gt; array(
            'type' =&gt; 'bar',
            'message' =&gt; t('Importing..'),
            'url' =&gt; 'import/progress', //url to fetch current progress percentage
            'interval' =&gt; '1000' //progress bar will refresh in 1 second
        )
    ),
);


Then create menu like this for url 'import/progress' :

$items['import/progress'] = array(
    'title' =&gt; t('Import progress'),
    'page callback' =&gt; 'import_progress',
    'access callback' =&gt; TRUE,
    'type' =&gt; MENU_CALLBACK,
);


Then output json data indicating current status like this in that page callback function:

function import_progress() {
    $progress = array(
        'message' =&gt; t('Starting import...'),
        'percentage' =&gt; -1,
    );

    $completed_percentage = variable_get('import_status'); // calculate progress percentage here

    if($completed_percentage){
        $progress['message'] = t('Importing...');
        $progress['percentage'] = $completed_percentage ;
    }

    drupal_json_output($progress);
}


Further reading: https://www.drupal.org/node/1401966