<script type="text/javascript"><!--
$('#btn1').bind('click', function() {
$.ajax({
type: 'POST',
url: 'index.php?route=module/calc/rasschet',
dataType: 'json',
data: 'ploschad=' + encodeURIComponent($('input[name=\'ploschad\']').val()) + '&lyudi=' + encodeURIComponent($('input[name=\'lyudi\']').val()),
beforeSend: function() {
// $('.success, .warning').remove();
$('#btn1').attr('disabled', true);
$('#zag').after('<div class="attention"><img src="catalog/view/theme/default/image/loading.gif" alt="" /> подожди!</div>');
},
complete: function() {
$('#btn1').attr('disabled', false);
$('.attention').remove();
notific.innerHTML = $('input[name=\'lyudi\']').val() + $('input[name=\'ploschad\']').val();
},
success: function(data) {
if (data.success) {
$('.buttons').after('<div id="notific">' + data.success + '</div>');
}
}
});
});
</script>
public function rasschet() {
$this->language->load('module/calc');
if ($this->request->server['REQUEST_METHOD'] == 'POST') {
$this->data['ploschad'] = $this->request->post['ploschad'];
$this->data['lyudi'] = $this->request->post['lyudi'];
$this->data['PC'] = $this->request->post['PC'];
$this->data['moschnost_priborov'] = $this->request->post['moschnost_priborov'];
$this->data['resultat'] = $this->data['ploschad'] + $this->data['lyudi'];
}
$this->response->addHeader('Content-Type: application/json; charset=utf-8');
$this->response->setOutput(json_encode($json));
}
вот вроде написал, но не выводит результат(