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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:43:30+00:00 2026-05-26T15:43:30+00:00

This function is wired up to the click event of a button: function BlahBlahBlahWCFXML()

  • 0

This function is wired up to the click event of a button:

function BlahBlahBlahWCFXML() { 
    varType = "POST"; 
    varUrl = "http://123.123.123.123/NameOfService.svc/GetStuffById"; 
    varData = '{"stuffId": "' + 12345678-abcd-9012-3456-abcdefghjkl' + '"}'; 
    varContentType = "application/json; charset=utf-8";  
    varDataType = "xml";  
    varProcessData = true; 
    CallService(); 
} 

That function then calls this one:

//Generic function to call AXMX/WCF  Service         
function CallService()  
{ 
        $.ajax({ 
            type        : varType, //GET or POST or PUT or DELETE verb 
            url         : varUrl, // Location of the service 
                    cache       : false, 
            data        : varData, //Data sent to server 
            contentType : varContentType, // content type sent to server 
            dataType    : varDataType, //Expected data format from server 
            processdata : varProcessData, //True or False 
            success     : function(msg) {//On Successfull service call 
            ServiceSucceeded(msg);                     
            }, 
            error: ServiceFailed// When Service call fails 
        }); 
} 

When I try to run the sample, I get the following in Google Chrome’s developer tools, console window:

Failed to load resource: the server responded with a status of 400 (Bad Request)
XMLHttpRequest cannot load http://123.123.123.123/NameOfService.svc/GetStuffById. Origin null is not allowed by Access-Control-Allow-Origin.

The service is working fine and I’m currently calling it from webforms and console apps. GetStuffById is the method I want to call. It accepts a string (GUID in this case) as a parameter and returns a string.

The service is a WCF service and is configured to return a SOAP message. I’d prefer JSON but that’s another issue for another question some other day.

Any ideas what’s going on here? Thanks!

UPDATE #1 – I changed the POST to a GET. Still no-go.

  • 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-26T15:43:31+00:00Added an answer on May 26, 2026 at 3:43 pm

    Looking at your code:

    1. All the variables inside BlahBlahBlahWCFXML are not accessible to CallService().
    2. varData‘s value has extra '(single quote). If the GUID is a constant value you can do away with the string concatenation and simply write:
      varData = '{"stuffId": "12345678-abcd-9012-3456-abcdefghjkl"}';

      However, if GUID is a variable, generate the GUID somewhere else and just put the variable here instead:
      varData = '{"stuffId": "' + varGUID + '"}';
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my code: function get_remote_file_to_cache(){ $sites_array = array(http://www.php.net, http://www.engadget.com, http://www.google.se, http://arstechnica.com, http://wired.com); $the_site=
When you attach a client-side click event via jQuery to an ASP.NET button do
Problem: New Inserted Dom elements aren't been wired correctly, function deletepost not firing. This
I have some elements with a function bound to the click event. I want
This function appears to be a way to access all sorts of system values.
This function declaration gives me errors: ostream& operator<<(ostream& os, hand& obj); The errors are:
This function is written in ActionScirpt. What kind of decryption this is? Is there
This function of mine keeps on failing an autograder, I am trying to figure
Is this function declaration in C#: void foo(string mystring) the same as this one
Imagine this function: void SoundManager::playSource(ALuint sourceID, float offset) { alSourceStop(sourceID); ALint iTotal = 0;

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.