Ajax Calc element takes long to process.

remico

Member
Hi all,

I have several calc elements in a form, processing "live" form data with AJAX calls. Everything works as expected, but very slow! Even when I do a simple "hello world" in my script it takes the server more then 2,5 sec (TTFB) to respond. I think that is is opening almost a "complete" joomla framework in the background. Is there a simple way to speed this up? The complete site loads in 2.7 sec so that is very acceptable, but the form takes forever to render 7 calc fields.

This is the code in one of the calc fields (sorry it is in Dutch...):
PHP:
include_once(JPATH_ROOT."/dreamview/calc/calc.php");
return prijs_btw('{dvf_reserveringen___prijs_totaal}');

This is the include calc.php
PHP:
defined('_JEXEC') or die();
ini_set('display_errors', 'on');
error_reporting(E_ERROR | E_WARNING | E_PARSE);

include_once(JPATH_ROOT."/dreamview/classes/classes.php");

function prijs_btw($prijs_totaal){
    $db =       FabrikWorker::getDbo();
    $instellingen = new instellingen();
    $prijs_totaal = $instellingen->string_prijs($prijs_totaal);
    $prijs_btw = $instellingen->prijs_string(($prijs_totaal - ($prijs_totaal/1.21)));
    return $prijs_btw;
}

I'm hoping for some tips and tricks!
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top