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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:14:40+00:00 2026-05-16T18:14:40+00:00

I use the protocol jsonp to call web methods. I use this code for

  • 0

I use the protocol jsonp to call web methods.

I use this code for the webservice:

public class Service1 : System.Web.Services.WebService
{
    [WebMethod]
    [ScriptMethod]
    public string HelloWorld()
    {
        return "Hello World";
    }
}

And this on Jquery with jason on client side:

        $.ajax({
            type: "POST",
            contentType: "application/json; charset=utf-8",
            url: 'http://localhost:50837/Service1.asmx/HelloWorld',
            data: {},
            dataType: "json",

            success: function(Msg) {
                alert('success:' + Msg.d.FirstName);

            },
            error: function(xhr, textStatus, errorThrown) {
                alert("error");
            }

        });

    }

This Jquery gives me always an error message, but I don’t know the reason.
Someone can help me?

  • 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-16T18:14:41+00:00Added an answer on May 16, 2026 at 6:14 pm

    You should place Web Service as a part on the site. If you don’t do this your code will not work because of Same Origin Policy problem (see ).

    You can place on the same site many application developed with different technique like ASP.NET MVC, ASMX Web Service and WCF service and all can work together very well. It’s the only way to be able without more complex JSONP. In you situation JSONP is oversized.

    You question is almost the same as Calling simple web service (.asmx file) from AJAX and JQuery using JSON – parse error. If you need a working Hello Wold example you will find an url to the full code example.

    You can read more about different ways of solving Same Origin Policy under Question about making XHR requests. After reading of that you will understand that Same Origin Policy problem is really complex. You can solve it, but in your case you not really have it need just place all on the same web site and use relative paths.

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

Sidebar

Related Questions

What protocol should I use to secure a webservice. I'm considering CHAP, but I
I'm using GSON for a project. In particular I use this code to generate
I'm trying to use Protocol Buffers for message serialization. My message format should contain
Okay, so my goal is to build a easy to use protocol for sending
I'm trying to use Google Protocol Buffers in my project and I'd like to
I am wondering how I can use google protocol buffers to accept a request
I installed Socat to use the Git Protocol Through a HTTP CONNECT Proxy, then
Why use the proposed OpenID OAuth Extension over another OAuth-based protocol? Discovery doesn't seem
Does DHCP use ARP only as communication protocol to assign an IP Address?
I'm trying to use extensions with Google's Protocol Buffers. I've got one main proto

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.