neethu neethu - 6 months ago 40
Javascript Question

POST HTTP://localhost:53122/albumlist.aspx/www 404 (Not Found)

I am using vb.NET .I need to call a function written in albumlist.aspx using jQuery as below:

var l = window.location;
var base_url = l.protocol + "//" +;
$(".pagen ").click(function() {
var num = $(this).attr('id');
type: "POST",
url: base_url + '/albumlist.aspx/www',
data: {
id: num
dataType: 'json',
encode: true,
async: false,
cache: false,
success: function(response) {
error: function(jqXHR, textStatus, errorThrown) {}

Function is:

Public Function wwww(ByVal id As Integer) As String
Return "jhgfjhf"
End Function

Using this code, getting 'POST http://localhost:53122/albumlist.aspx/www 404 (Not Found)'. What should I do, I am new to vb.


There could be other problems, but I can spot at least two. First, you have to mark the method with the <WebMethod> attribute. Second, methods inside of an .aspx page must be marked as Shared in order to be visible as web methods.