I want to run function inside web service (.asmx file)
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: '/Admin/WebSrvcs/Management.asmx/f_SearchLabel',
data: "{_sQuery:'" + obj.value + "'}",
dataType: "json",
But I don't know where will be my root url(http://localhost:4399/VirDir or something else it may be) address inside js file. And i need to reach root folder of application to find asmx file.
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: 'http://localhost:4399/virDir/Admin/WebSrvcs/Management.asmx/f_SearchLabel',
data: "{_sQuery:'" + obj.value + "'}",
dataType: "json",
I am working on Visual Studio 2008 and building web site with C#.
any help would be greatly appreciated
If you're using Master Pages then this becomes handy:
In the HEAD of Master Page:
<script type="text/javascript">
var baseUrl = '<%# ResolveUrl("~/") %>';
function ResolveUrl(url) {
if (url.indexOf("~/") == 0) {
url = baseUrl + url.substring(2);
}
return url;
}
</script>
In the Master Page .cs page:
protected void Page_Load(object sender, EventArgs e)
{
Page.Header.DataBind();
}
Then in your javascript:
ResolveUrl("~/Admin/WebSrvcs/Management.asmx/f_SearchLabel")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With