Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 909161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T16:49:55+00:00 2026-05-15T16:49:55+00:00

I am using JQuery & JSON (POST) to call webmethod. However I can call

  • 0

I am using JQuery & JSON (POST) to call webmethod. However I can call only webmethod located at aspx file but not in asmx file

Below are sample codes

CustomValidate.asmx

Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel


Public Class CustomValidate
Inherits System.Web.Services.WebService

'ACCESS VIA JSON

<System.Web.Services.WebMethod()> _
Public Shared Function AJAX_Test(ByVal date1) As Boolean
...

    Return True
End Function
End Class

Javascript: JQuery JSON

function isDates(source, arguments) {
                var isValidDate;
                $.ajax({
                    type: "POST",
                    contentType: "application/json; charset=utf-8",
                    url: "CustomValidate.asmx/AJAX_Test",
                    data: '{date1: "' + arguments.Value + '"}',
                    dataType: "json",
                    async: false,
                    success: function(result) {

                        isValidDate = result;
                    },
                    error: function(httpRequest, textStatus, errorThrown) { 
                       alert("status=" + textStatus + ",error=" + errorThrown);
                    } 

                });
                arguments.IsValid = isValidDate;
            }

It always return javascript undefined error. But if I put the AJAX_Test webmethod in aspx page and replace the url: “CustomValidate.asmx/AJAX_Test” to “mypage.aspx/AJAX_Test”. It works fine. Any idea?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T16:49:55+00:00Added an answer on May 15, 2026 at 4:49 pm

    You are using what is known as a “Page Method”. That is, a static (Shared) method with a [WebMethod] attribute on it. These only work inside of an .ASPX page. They are intended to be used only by JavaScript running on the page.

    Try removing the Shared from the method and see if it works better.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to submit a simple jQuery ajax call but using the DELETE method
In a POST to an MVC controller, I'm using JQuery to send a JSON
I want to call a JSON method on my textbox change event using jquery.
Hi I am using ajax post and json in jquery to read the database
I am trying to call an ASMX from jQuery using JSON and get a
Does JSON, JQuery & ASP.NET 2.0 webforms go together or is it only preferred
I'm using JQuery to find certain div classes within DOM & If they found
I am using jquery UI tabs. I have 2 tabs with id #tab1 &
I am using knockoutjs with the jquery drag & drop and it works well
I'm developing application using backbone.js & jquery. I have following code in model: runReport:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.