Hello,
I am stuck with the following issue: i have an input on a form. The value from that field is a random value. I try to pass this value to the server by button click. But i am not able
Here is the chunk code:
<input type="button" style="boder:0; color:#f6931f; font-weight:bold;" value="Salveza cheltuieli" onclick="javascript:insertName()">
<script type="text/javascript">
function insertName(){
var value = $('#amount').val();
$.ajax({
url: '[[!settotal]]',
type: 'POST',
success: function(){
$('#totalvalue').text(value);
}
});
}
</script>
In ajax I call the settotal snippet which looks like:
$sql = 'UPDATE `modx_users_total` SET `total` =57
WHERE CONVERT(`id` USING utf8) = \'1\' LIMIT 1';
$modx->exec($sql);
Nothing complicated i think.
But i can not send a value to the snippet.
Seems like a different behavior of $.ajax() in MODX than in simple PHP/html
DId anyone encounter such a problem, or if anyone could suggest the way to dig - i would appreciate that.
Regards,
Nicolae