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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:21:06+00:00 2026-05-13T16:21:06+00:00

I have a Page that expects a POST Request and returns some JSON. Essentially

  • 0

I have a Page that expects a POST Request and returns some JSON. Essentially it’s an .ashx Page, but that doesn’t really matter.

When using jQuery, I would use jQuery.Post with “json” as dataType to simply make the POST request and get an object back. However, for the current project I mainly use ASP.net AJAX and I don’t want to add jQuery just for the call.

For ASP.net AJAX, I only found information on how to call a “traditional” web service though, which means adding a asp:ServiceReference to the ScriptManager and having a “real” Web Service at the end.

Is there a simpler way to make a POST call to a Page? I could live with getting the raw JSON and then manually eval()ing it, but I don’t want to create a full asmx web service (deploying them on SharePoint is a bit painful, and my ashx handler works fine)

  • 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-13T16:21:07+00:00Added an answer on May 13, 2026 at 4:21 pm

    Sys.Net.WebServiceProxy wasn’t helpful because it seems to expect a real web service at the end – Request.Form was empty on the server side, parametersDictionary seems to be ignored. There also seems to be no override to wire up another executor instead.

    I now solved it by manually creating a Sys.Net.WebRequest. I’l going to take a look at the jQuery sources as this approach is a lot more complex/”bare-metal”, but as said, I don’t want to add a dependency on jQuery if it isn’t needed.

    var ApplicationFunctions = {
        showDialog: function(someParam, someOtherParam) {
            var sb = new Sys.StringBuilder("Do you really want to do '");
            sb.append(someParam);
            sb.append("' ?");
            var msg = sb.toString();
            if (confirm(msg)) {
                var myWebRequest = new Sys.Net.WebRequest();
                myWebRequest.set_url('SomeService.ashx');
                myWebRequest.set_httpVerb('POST');
                // Manually build POST body. This would need escaping/urlencoding
                // I think if I couldn't guarantee that the parameters are 'clean'
                var bodySb = new Sys.StringBuilder("postParam=");
                bodySb.append(someParam);
                bodySb.append("&anotherPostParam=");
                bodySb.append(someOtherParam);
                var body = bodySb.toString();
                myWebRequest.set_body(body);
                myWebRequest.get_headers()["Content-Length"] = body.length;
                // also check out usercontext to pass additional data into the completed function
                // http://msdn.microsoft.com/en-us/library/bb397436.aspx
                myWebRequest.add_completed(ApplicationFunctions.onCallCompleted);
                myWebRequest.set_timeout(10 * 1000); // 10 seconds
                myWebRequest.invoke();
            }
        },
        onCallCompleted: function(response) {
            if (response.get_timedOut()) {
                alert("Timed Out!");
                return;
            }
            if (response.get_statusCode() !== 200) {
                alert("Status Code not OK");
                return;
            }
            if (!response.get_responseAvailable()) {
                alert("No data available?!");
                return;
            }
            // Better use a JSON parser
            // http://www.json.org/js.html
            var responseData = eval('(' + response.get_responseData() + ')');
            alert("Success: " + responseData.SomeField);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 342k
  • Answers 342k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

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

    • 7 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Starting from Doctrine 1.2, the models autoloading is dealt by… May 14, 2026 at 5:12 am
  • Editorial Team
    Editorial Team added an answer For the client side you want to use the No-Cache… May 14, 2026 at 5:12 am
  • Editorial Team
    Editorial Team added an answer I believe you are looking for the AutoPostBack option. Set… May 14, 2026 at 5:11 am

Related Questions

I'd like to post some form variables into a classic ASP page. I don't
I'm developing front-end code for a web application, and ran into an odd piece
When I use Google Chrome to make an AJAX POST request I get extra
I have an Asp .net page like this simple one http://issamsoft.com/app2/page1.aspx and I want
I am going to be writing an application that does a bit of computation

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.