JQuery Ajax and Web Service

Posted by Community Admin on 04-Aug-2018 13:07

JQuery Ajax and Web Service

All Replies

Posted by Community Admin on 13-Jun-2014 00:00

Hi

I'm trying to use  jQuery to call Sitefinity/Public/Services/Ecommerce/Order/CartOrder.svc
and get the current cart item (GetCartOrder)

The jquery is working, however it's returning all cart items/orders
NOT the specific item for $.cookie("shoppingCartId")

Tested direct url in browser and it works!

Code below:

            $.ajax(
                type: "GET",
                contentType: "application/json; charset=utf-8",
                url: getBaseURL() + "Sitefinity/Public/Services/Ecommerce/Order/CartOrder.svc",
                data: cartOrderId: $.cookie("shoppingCartId") ,
                dataType: 'json',
                success: function (data, textStatus, jqXHR)
                    alert("success");

Any help appreciated... :

 Regards

Martin

Posted by Community Admin on 13-Jun-2014 00:00

Figured it out !!!

 Simply append the shoppingCartId to the URL:

url: getBaseURL() + "Sitefinity/Public/Services/Ecommerce/Order/CartOrder.svc/" + $.cookie("shoppingCartId") + "/",

Martin

This thread is closed