Hello all,
I am attempting to calculate the value of a field when another field is changed. My ajax call is going where it needs to go and works if the “data.price” value is hard coded. Here is the ajax call:
$.ajax({
type: "POST",
url: "custom/modules/cq_ProjectQuotes/scripts/updatepricing.php",
data: the_data,
dataType: "json",
success: function(data){
document.getElementById("cq_commission_3_c").value = data.price;
}
});
The data is being sent to the correct file. If I hard code something like
$price = array("price" => '23.00');
echo json_encode($price);
the “cq_commission_3_c” value is set to 23.00. The problem comes when I try and run a query on the updatepricing.php page to get the correct value of “data.price”.
I have tried $this->db = DBManagerFactory::getInstance(). $db = DBManagerFactory::getInstance(), and $GLOBALS[“DB”]. Each one of these results in a Server 500 error.
Is it possible to post using AJAX and run a query on the URL I am posting to?
Thanks!