Since you are doing a POST you'll want to use something like HttpContext.Current.Request["data"] instead of accessing inputString. To pass it as an actual parameter you need to do a GET to "/base/myAlias/MyMethod/yourDataGoesHere" - but it's probably best to do a POST if you have JSON data.
Umbraco Base Json Param
Hi ,
i have next method :
public static bool MyMethod(string inputString)
I'm trying to call this function with Ajax Jquery
jQuery.ajax({
type: "POST",
url: "/base/myAlias/ MyMethod /",
data: '{ "data": "Test" }',
contentType: "application/json; charset=utf-8",
dataType: "json",
async: true,
cache: false,
success: function (msg) {
alert(msg.d);
}
});
});
Hi,
Since you are doing a POST you'll want to use something like HttpContext.Current.Request["data"] instead of accessing inputString. To pass it as an actual parameter you need to do a GET to "/base/myAlias/MyMethod/yourDataGoesHere" - but it's probably best to do a POST if you have JSON data.
-Tom
is working on a reply...