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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:32:01+00:00 2026-05-13T22:32:01+00:00

Been doing some playing call my service which is on a different domain using

  • 0

Been doing some playing call my service which is on a different domain using jQuery. The call to the service is successfully made (my debug point gets tripped), and the correct response is returned (I sniff the traffic).

My problem is mainly that the success and failure callbacks don’t get fired. I have read some other posts on SO that indicate the error event is not fired when using JSONP. Is that the case with the success event (perhaps because it is assumed that I am providing my own callback function), as well, or is there a way to fire my success callback. Thanks in advance.

$.ajax({
  type: "GET",
  url: urlOnDiffDomain,
  async: false,
  cache: false,
  dataType: 'jsonp',
  data: {},
  success: function(data, textStatus) {
    alert('success...');
  },
  error: function(xhr, ajaxOptions, thrownError) {
   alert('failed....');
  }
}); 
  • 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-13T22:32:02+00:00Added an answer on May 13, 2026 at 10:32 pm

    Alright. In case anyone needs to know in the future…In hindsight, the solution probably should have been more obvious than it was, but you need to have the web-response write directly to the response stream. Simply returning a string of JSON doesn’t do it, you need to someone construct it and stream it back. The code in my original post will work fine if you do indeed do that.

    Example of service code:

    public void DoWork()
    {
      //it will work without this, but just to be safe
      HttpContext.Current.Response.ContentType = "application/json"; 
      string qs = HttpContext.Current.Request.QueryString["callback"];
      HttpContext.Current.Response.Write(qs + "( [{ \"x\": 10, \"y\": 15}] )");
    }
    

    Just for the sake of being explicit, this is the client-side code.

    function localDemo(){
      $.getJSON("http://someOtherDomain.com/Service1.svc/DoWork?callback=?",
        function(data){
          $.each(data, function(i,item){            
            alert(item.x);
          });
      });
    }
    

    If there is a better way to do this, I am all ears. For everyone else, I know there is some concept of native support in WCF 4.0 for JSONP. Also, you may want to do a little checking for security purposes – though I have not investigated much.

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

Sidebar

Related Questions

I've been doing some HTML scraping in PHP using regular expressions. This works, but
I've been doing some performance testing around the use of System.Diagnostics.Debug, and it seems
I'been doing some inheritance in js in order to understand it better, and I
I've been doing some mocking with RhinoMocks and it requires that mocked methods be
I've been doing some Web-Projects lately that rely on heavy Data-Binding and have been
I've been doing some socket programming to transmit information across the wire. I've run
We have been doing some research into physically isolating the secure and non-secure sections
I've been doing some research on how to globally handle errors in my ASP.NET
I've been doing some reading about the people building an emulator for the Wii
I've been doing some WPF development for the last few months, and I've recently

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.