Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi,
I'm tring to call a aspx Webmethod using Ajax, but its not hitting the method rather the url says:
Page not found
No umbraco document matches the url '/Page.aspx/MethodName'.
This page can be replaced with a custom 404. Check the documentation for "custom 404".
This page is intentionally left ugly ;-)
My ajax code:
$.ajax({ type: "POST", url: 'Page.aspx/MethodName', contentType: "application/json; charset=utf-8", data: '{ "Name": "name" }', dataType: "json", success: function (response) { alert(response); } });
Method code:
[System.Web.Services.WebMethod] public static string MethodName(string Name) { return Name; }
Hi Hussain,
Welcome to our forum!
You don't need to use .aspx pages and web page methods for getting data from your site when you are using Umbraco.
You have to create webApi or Surface controller and get data from there.
Read more abour webapi: https://our.umbraco.org/documentation/reference/routing/webapi/
Example of GET method:
public class ProductsController : UmbracoApiController { public IEnumerable<string> GetAllProducts() { return new[] { "Table", "Chair", "Desk", "Computer", "Beer fridge" }; } }
Example of url:
~/Umbraco/Api/Products/GetAllProducts
Thanks,
Alex
Did you solve your problem?
Please, answer something, maybe we will find solution together!
Thanks
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Calling a Webmethod using Ajax
Hi,
I'm tring to call a aspx Webmethod using Ajax, but its not hitting the method rather the url says:
Page not found
No umbraco document matches the url '/Page.aspx/MethodName'.
This page can be replaced with a custom 404. Check the documentation for "custom 404".
This page is intentionally left ugly ;-)
My ajax code:
Method code:
Hi Hussain,
Welcome to our forum!
You don't need to use .aspx pages and web page methods for getting data from your site when you are using Umbraco.
You have to create webApi or Surface controller and get data from there.
Read more abour webapi: https://our.umbraco.org/documentation/reference/routing/webapi/
Example of GET method:
Example of url:
Thanks,
Alex
Hi Hussain,
Did you solve your problem?
Please, answer something, maybe we will find solution together!
Thanks
is working on a reply...