The following worked for me:
function GetShoppingCartData() {
jQuery.ajax({
type: "POST",
url: "DesktopModules/EcomDnnProducts/AjaxProductDisplay.aspx/GetShoppingCartData",
data: "{'CartId': '" + jQuery(".shoppingcartid").attr("value") + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
async: true,
cache: false,
success: function (msg) {
//jQuery('#productattributesdata').text(msg.d);
buildShoppingCart(msg.d);
},
fail: function (msg) {
jQuery('#productattributesdata').text(msg.d);
}
});
}
you do not need the "data:...." bit
I had to make changes to my ASP page to get it to work.
My function looks like this:
<System.Web.Services.WebMethod()> _
Public Shared Function GetShoppingCartData(ByVal CartId As String) As String
Dim ReturnString As String = ""
Try
ReturnString = "test1;test2;test3"
Catch ex As Exception
'ProcessModuleLoadException(Me, exc)
Dim DataLogger As New DataLogger
DataLogger.WriteToEventLog("Error", ex.Message & " - " & ex.StackTrace)
End Try
Return ReturnString
End Function
Will see if there was any other settings...
Added the following to the web.config to give permissions for the thing to be called:
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
</customHeaders>
</httpProtocol>
</system.webServer>
Not sure if this is the missing bit.
Some more resources:
http://msdn.microsoft.com/en-us/library/byxd99hx(v=vs.80).aspx
http://www.dotnetcurry.com/ShowArticle.aspx?ID=109
http://forums.asp.net/t/1298480.aspx/1
HTH
Shaun