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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:57:38+00:00 2026-05-29T07:57:38+00:00

I just cannot get this to work! Whenever I click the button nothing happens.

  • 0

I just cannot get this to work! Whenever I click the button nothing happens. Have replaced the .load method with .text(‘hello world’) and it works so seems like my problem is in the url of the method. Have looked everywhere for an answer but think I must be overlooking something really obvious as have not seen the same thing posted anywhere. Please help its driving me crazy!!!

Client-Side:

    <script src="Scripts/jQuery-1.7.1.js" type="text/javascript"></script>
    <script type="text/javascript">
    // Cannot get this to work
        $(function () {
            $('#buttonSays').click(function () {
                $('div').load('AjaxServices.asmx/HelloWorld');
            });
        });
    </script>
</head>
<body>
    <h1>Hello World from Web Service</h1>
    <button type="button" id="buttonSays">Get Info</button>
    <p>The site says...</p>
    <div id="divSays1"></div>
    <div id="divSays2"></div>
    <div id="divSays3"></div>
</body>

Server-Side:

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService]
public class AjaxServices : System.Web.Services.WebService
{

private static int count = 0;

[WebMethod]
public string HelloWorld()
{
    count++;
    return "Hello World #" + count.ToString();
}
  • 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-29T07:57:40+00:00Added an answer on May 29, 2026 at 7:57 am

    While this may not be what’s causing your problem, a common issue that prevents .Net web services from working with jQuery is that GET and POST requests are not allowed by default. Make sure that you have enabled the appropriate method(s) in your web.config using the code below:

    <webServices>
        <protocols>
            <add name="HttpGet"/>
            <add name="HttpPost"/>
        </protocols>
    </webServices>
    

    I believe you could also specify which method(s) are allowed at the WebMethod level:

    [ScriptMethod(UseHttpGet = true)]
    public string HelloWorld()
    {
        count++;
        return "Hello World #" + count.ToString();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just cannot get this to work, would appreciate if someone can help. So
I must have looked at 10-15 tutorials on this already but just cannot get
I've tried to build this myself and just simply cannot get it to work.
A daft question, but I really cannot get this to work: I have some
I cannot get the jQuery slideDown function to work on <table> elements. They just
I just cannot work this out. My god it's making my brain hurt, so
I know this is embarrassing easy but I cannot get this to work right
I have now tried to get this to work for a few hours but
I hopefully have a simple question I just cannot get anything I try to
I have google the heck out of this an I cannot get an answer

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.