My .ready()
method does not call the function that it supposed to. The function alone is working fine, but when I try to execute it as the first thing after page is loaded, it does nothing. I went through existing topic but could not find the way of fixing it.
I should add that I want my function to be executed after page is loaded as well as after clicking a button(that part works at the moment)
My code:
<script>
$(document).ready(function() {
calculation();
});
function calculation() {
variable = new XMLHttpRequest();
var total = 0;
if($('#p1').val() && $('#qty').val()){
var price = $('#p1').val();
var qty = $('#qty').val();
total += price * qty;
}
$('#total').val(total);
}
</script>