Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Call Two Methods in Ajax

$
0
0

Hello Friends!! I am trying to pass two methods in ajax. For example one method for product's individual price/quantity while updating in the shopping cart and another for the total price of products purchased of a specific buyer. The first method is working well but I am wondering how to pass the second method in the same way. I've tried something as follows: For the first method I've passed two parameters and for the second one no parameters.

<script type="text/javascript">
        function getTotalPrice(obj) {

            var pacval = $(obj).val();$.ajax({
                url: 'GetAjaxData.aspx/getSellPrice',
                type: 'POST',
                data: JSON.stringify({ CartID:2, Quantity: pacval }),
                //data: '{CartID: "' + $("#txtCartID" + indx).val() + '",Quantity: "' + $("#txtQuantity" + indx).val() + '" }',
                dataType: "json",
                contentType: "application/json; charset=utf-8",
                success: function (data) {$(obj).closest("td").closest("tr").find("span[id^='TotalPrice']").text(data.d)
                    addition();
                },
                error: function (xhr, textStatus, errorThrown) {
                }
            }),$.ajax({
                url: 'GetAjaxData.aspx/getDetails',
                type: 'POST',
                dataType: "json",
                contentType: "application/json; charset=utf-8",
                success: function (data) {$(obj).find("span[id^='PriceTotal']").text(data.d)
                },
                error: function (xhr, textStatus, errorThrown) {
                }
            });
        }</script></body>

And scenario looks as follows - When anyone writes the quantity, the price and quantity will be updated regarding the row id: Any idea or suggestion would be appreciated. Thanks.

ProductID

Quantity

Unit Price

Price

1

2

2000

4000

2

4

2000

8000

Total Price: $12,000

ProductID

Quantity

Unit Price

Price

1

2

2000

4000

2

4

2000

8000

Total Price: $12,000


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>