I have to fire an ajax call against two different domain based on the platform of the client (mobile/desktop):
var baseDomain = (isMobile()) ? "http://m.test.com" : "http://www.test.com";
function AddProduct(ProductId, ButtonClientId) {
$.ajax({
type : "POST",
eval("url : \""+baseDomain+"/data/call.aspx/AddToShoppingCart\",");
contentType : "application/json; charset=utf-8",
data : '{productId:' + ProductId + ', quantity: 1, isSingle: true}',
dataType : "json",
success : function(data) {
ProductAddedSuccess(data.d, ButtonClientId);
},
error : ProductAddedError
});
}
I cannot go thru this as I always get the "SyntaxError: missing formal parameter". Where I'm wrong?