function getmet() {
$.ajax({
url: "url",
type: "POST",
datatype: "json",
data: {rep_id: <?=$report->reportLogId?>},
success: function(data, textStatus){
if (data != '') {
var rep = jQuery.parseJSON(data);
if (rep.status == 2) {
window.location.reload();
} else if (rep.status == 1 && rep.in_line == 1) {
progress = 'расчет ' + rep.time + ' сек';
} else if (rep.status == 0 || rep.status == 1 && rep.in_line != 1) {
progress = 'в очереди ' + rep.need_line + ' из ' + rep.in_line;
}

var str = '<img src="/images/load.gif"> <br><br>Статус (' + progress + ')';

$('#report_dialog').html('');    //jquery вывод
$('#report_dialog').html(str);
}
}
});

 

public function actionAjaxRep () {

/// die("123");

$repId = CMSUtils::getExtVar('rep_id', 'num', false, false, 0);
$sql = "ololo";
$res = CMSDb::fetchRow($sql);
if (isset($res)) {
$rep = CMSDb::fetchRow($sql);
$time = microtime(1) - $res['generate_time_start'];

$arJson = array(
'status' => $res['status'],
'in_line' => $rep['all'],
'need_line' => $rep['need'],
'time' => round($time, 0)
);
echo json_encode($arJson);
}

 

}

}

console.log  удобный вывод в консоль

 

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

   
© 2012 Программирование в удовольствие Яндекс.Метрика Suffusion theme by Sayontan Sinha