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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:20:18+00:00 2026-06-14T15:20:18+00:00

I am trying to use $.ajax.post using: $.ajax({ type: POST, url: http://localhost/products/SaveXML.aspx, data: {

  • 0

I am trying to use $.ajax.post using:

       $.ajax({
                type: "POST",
                url: "http://localhost/products/SaveXML.aspx",
                data: { name: "John", location: "Boston" }
            }).done(function (msg) {
                alert("Data Saved: " + msg);
            });               
        });

SaveXML lookes like:

<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"       
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script language="c#" runat="server">

public void testMethod()
{              
    string sayHello = "hello world";
}

</script>

<html xmlns="http://www.w3.org/1999/xhtml">
   <head runat="server">
      <title></title>
   </head>
   <body>
   <form id="form1" runat="server"></form>
   </body>
</html>

Eventually, I want to pass in some XML and have SaveXML handle it.

Does the code need to be in a code-behind? Does it need to be marked as a web method?

Can someone show me what this should look like please?

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-14T15:20:19+00:00Added an answer on June 14, 2026 at 3:20 pm

    The code needs indeed to be server side code (which doesn’t mean you have to have a code behind file – what you have with your testMethod will work just fine, as it is in a server side context).

    Since you are posting the data to the .aspx page, there is no need to use a web method. You can use Page_Load or OnInit to get the posted data (via the Request page property) and handle the posted data in it.

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

Sidebar

Related Questions

I'm trying to use jquery.Ajax to post data to an ASP.NET MVC2 action method
I am trying to use relative url with a post ajax call as follows:
I am trying to post data using ajax in jquery of json datatype. I
I am trying to use .ajax() to post a People object to a MVC2
I am using HMVC codeigniter. I am trying to use jquery ajax first time.
I am using CakePHP 1.26 . I was trying to use jQuery Ajax to
I'm trying to access a 3rd party api over http using jquery .ajax (or
Currently Im trying to do ajax request using jQuery Mobile. I`m trying to use
I'm trying to post data via ajax, this is my info: var jsondata =
I'm trying to use wordpress' built-in ajax to process an upload using the AjaxUpload

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.