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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:27:03+00:00 2026-05-20T11:27:03+00:00

i have a web service project called (WS_Service) i have a html page thats

  • 0

i have a web service project called (WS_Service)
i have a html page thats trying to consume WS_Service.

i have web services sits on its own project (the reason i have created is because its independednt and can be called from .aspx or .html or mobile)

i dont have problem with .aspx and i have just add the reference and fire the services.

but i am not sure how i will be doing on .html page below is my code i am trying to POST to a web service:

 $.ajax({ 
      type: "POST", 
      url: "http://myhostname/Delete.asmx/DeleteCustomer",  <<< is that right?
      data: "{CustID: " + parseInt(customer_id) + "}", 
      contentType: "application/json; charset=utf-8", 
      dataType: "json", 
      success: function(msg) { 
                     AjaxSucceeded(msg); 
               }, 
      error: AjaxFailed 
 }); 

any suggustions?

  • 1 1 Answer
  • 2 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-20T11:27:03+00:00Added an answer on May 20, 2026 at 11:27 am

    First off, you can’t POST to a form that’s on another domain using AJAX. So make sure that you aren’t trying to POST to domain1.com when the Javascript is running on domain2.com.

    Assuming they are on the same domain, you are pretty close, but if you’re trying to post JSON to using jQuery I would just do something like this:

    var data = {
        CustID: parseInt(customer_id)
    };
    
    $.post("http://myhostname/Delete.asmx/DeleteCustomer", {data: JSON.stringify(data)}, function(response) {
      //success
    });
    

    That will send through your JSONified object in a POST variable called data on the server side of things.

    Don’t try to mess with building the JSON yourself in a string, that will get very messy if you start sending complicated data. That’s why they invented the JSON functions. $.post is just a shortcut to $.ajax with some default stuff already configured that should be fine for your use. If you really need to capture AJAX errors (like HTTP Status Codes), have a look at $.ajaxError as a supplement.

    You can include a simple JSON compatibility script in your page if you are supporting legacy browsers that don’t have the JSON.stringify and JSON.parse functions, like https://github.com/douglascrockford/JSON-js

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

Sidebar

Related Questions

I have a RESTful WCF web service called "Palladium" as a project in my
I have a WCF web service called Palladium that is created as a project
I have a Windows forms project and a Web Service project in my solution,
I have a VS2005 project that contains a couple web service references. The project
I have a simple task. I have an existing project with a web service
Interesting one here. I have an ASP.NET 1.1 project that contains a web service
I have a .net project that has a web reference to a service. I
I have numerous Web Services in my project that share types. For simplicity I
I have been working on a web services related project for about the last
I'm working on a project where I have 2 web services that need the

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.