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

  • Home
  • SEARCH
  • 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 243325
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T20:54:42+00:00 2026-05-11T20:54:42+00:00

Simply put I want to call public static methods decorated with WebMethod attribute inside

  • 0

Simply put I want to call public static methods decorated with WebMethod attribute inside my code-behind C# file from jquery.ajax to get some json and other simple stuff (in different functions). But instead I’m getting whole page :'(

I’m not using asp.net AJAX though I’m developing for .NET 3.5 framework and using VS 2008. (There are some restrictions from client)

Please let me know if I can use page-methods with using asp.net ajax or If not what is other simple solution?

  • 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-11T20:54:43+00:00Added an answer on May 11, 2026 at 8:54 pm

    After much deliberations I found the problem. I was using jquery’s editable plugin. This was source of the problem. When jeditable calls jquery’s ajax it sets ajax options like this:

        var ajaxoptions = {
            type: 'POST',
            data: submitdata,
            url: settings.target,
            success: function(result, status) {
                if (ajaxoptions.dataType == 'html') {
                    $(self).html(result);
                }
                self.editing = false;
                callback.apply(self, [result, settings]);
                if (!$.trim($(self).html())) {
                    $(self).html(settings.placeholder);
                }
            },
            error: function(xhr, status, error) {
                onerror.apply(form, [settings, self, xhr]);
            }
        };
    

    so it was sending the things as simple html and to use this with page methods we need to setup the things so that it sends as json. So we need to add something to the settings like this:

        var ajaxoptions = {
            type: 'POST',
            data: submitdata,
            url: settings.target,
            dataType: 'json', //Data Type
            contentType: 'application/json; charset=utf-8', //Content Type
           //....other settings
        };
    

    So I put two new properties in settings dataType and contentType and changed above to this:

        var ajaxoptions = {
            type: 'POST',
            data: submitdata,
            url: settings.target,
            dataType: settings.dataType,
            contentType: settings.contentType,
           //....other settings
        };
    

    Now another problem arised 🙁 it was sending data (from submitdata property) as normal query-string which asp.net does not accept with json requests. So I had to use jquery’s json plugin and change the way data is sent in ajax using following test on dataType:

        if (settings.dataType == "json") {
            if ($.toJSON) {
                submitdata = $.toJSON(submitdata); 
            }
        }
    

    and it works like breeze!!!

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

Sidebar

Ask A Question

Stats

  • Questions 211k
  • Answers 212k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer If you're using XSLT 2.0, the canonical answer to your… May 12, 2026 at 10:16 pm
  • Editorial Team
    Editorial Team added an answer No, there is no API for Google Voice announced as… May 12, 2026 at 10:16 pm
  • Editorial Team
    Editorial Team added an answer There are two options, the one mentioned by benlumley: Turn… May 12, 2026 at 10:16 pm

Related Questions

I'm the lead dev for Bitfighter , and am adding user-scripted bots using Lua.
EDIT 1 I apologize but after reading the 2 suggested articles I still don't
Item is a simple model class. ItemComponent is a view for an Item which
I was just wondering about something. I have a frame that loads pages and

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.