object - How to Sum the 2 result query from jquery -
how can sum 2 number jquery. i'm doing here chained select, first select product (book), if select jquery display price. second select page (how many page) if select jquery display price db. tried adding got nan or [object object]. please help.
jquery
$(document).ready(function () { //disable not 1st select $("#description").attr("disabled", "disabled"); $("#orientation").attr("disabled", "disabled"); $("#page").attr("disabled", "disabled"); //start----------------------compny $("select#company").change(function () { $("#description").html("<option>wait...</option>"); var id = $("#company option:selected").attr('value'); $.post("./includes/select_type.php", { id: id }, function (data0) { $("#description").removeattr("disabled"); $("#description").html(data0); }); }); //start----------------------page $("#description").change(function () { $("#page").html("<option>wait...</option>"); var id2 = $("#description option:selected").attr('value'); $.post("./includes/select_insidepage.php", { id2: id2 }, function (data1) { $("#page").removeattr("disabled"); $("#page").html(data1); //show price--------------------------- $("#price").html(data1); $("#price2").html(data1); }); }); //start----------------------orientation $("#page").change(function () { $("#orientation").html("<option>wait...</option>"); var id3 = $("#page option:selected").attr('value'); $.post("./includes/select_orient.php", { id3: id3 }, function (data2) { $("#orientation").removeattr("disabled"); $("#orientation").html(data2); //show insidepageprice----------------- $("#insidepage").html(data2); $("#insidepage2").html(data2); //show total price----------------- $("$total").html(+data + +data2); }); });
Comments
Post a Comment