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 7772535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:54:43+00:00 2026-06-01T16:54:43+00:00

I am trying to call a C# method from java script ,I am new

  • 0

I am trying to call a C# method from java script ,I am new to web development and after a bit of searching decided on using jquery to do the same,the way I try to call the method is:

$.ajax({
          type: "POST",
          url: "Default.aspx/IncrementJ",
          data: "{}",
          contentType: "application/json; charset=utf-8",
          dataType: "json",
          success: function(msg) {
            alert("success!")
          }
        });

here IncrementJ is my function name defined in C# which I want to call.here is the definition:

 [WebMethod]
    public static  void IncrementJ()
    {

        try
        {
            j++;
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }

when I run my program web console throws an error “cannot locate resource incrementJ”;please tell me where I am going wrong,

Thanks .

  • 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-06-01T16:54:44+00:00Added an answer on June 1, 2026 at 4:54 pm

    Given your comments that the error status 404 (Not Found), can infer that the error is on behalf of the calling script:

    “Http Response Codes for Dummies”

    50x: we messed up. 
    40x: you messed up. 
    30x: ask that dude over there. 
    20x: cool.
    

    So, given that the script cannot find the webmethod, I think its fair to deduce that it is looking in the wrong location. Try putting a relative path when referencing Default.aspx/IncrementJ.

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

Sidebar

Related Questions

I'm new for Jquery. I'm trying to call server method from my user control
I am trying to call my Javascript method from my java in GWT below
i am trying to call a navite method defined in c++ from java, the
I'm trying to call a Page Method using a jQuery 'attached' event function, in
I have a new MacRuby application. I'm trying to call a MacRuby method from
I'm trying to call a C# method from JavaScript by using ActiveXObject : var
I am trying to call a method in a Java applet from JS. I
I'm trying to call method from .jar But when I want to declare array
I am trying to make a call to a Parent class method from a
I am trying to call the browse() method of the FileReference class from JavaScript

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.