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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:36:01+00:00 2026-05-27T03:36:01+00:00

Friends, I’m lost here. I have this WCF Rest service returning data in json

  • 0

Friends, I’m lost here.

I have this WCF Rest service returning data in json format: http://189.126.109.249/ieptb/Cidades?uf=SP

I can access it using a asp.net web form application and also, I can access it using a Windows Phone application. But I’m not getting to make it work under a simple jQuery.$Ajax() call. My jQuery is always returning an error. If you take a look into my code you will see I have a function for catching errors.

Here is the script I’m using: http://jsfiddle.net/n6sLQ/4/

I’ve tested with Fiddler, and it shows me that HTTP response is 200 (ok), even it shows me the json array returned, like this:

HTTP/1.1 200 OK
Via: 1.1 CM-SRV03
Connection: Keep-Alive
Proxy-Connection: Keep-Alive
Content-Length: 2360
Date: Tue, 29 Nov 2011 13:02:44 GMT
Content-Type: application/json; charset=utf-8
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 4.0.30319
Cache-Control: private

[{"Nome":"AGUAS DE LINDOIA","Uf":"SP"},{"Nome":"AMERICANA","Uf":"SP"},{"Nome":"AMPARO","Uf":"SP"}]

I dont know what is wrong with my jQuery…

  $.ajax({
            url: "http://189.126.109.249/ieptb/Cidades?uf=SP",
contentType:"application/json",
            dataType: "json",

            error: function (x, e) {
                if (x.status === 0) {
                    alert('You are offline!!\n Please Check Your Network. ' + x.reponseText);
                }
                else if (x.status == 404) {
                    alert('Requested URL not found.');
                } else if (x.status == 500) {
                    alert('Internel Server Error.');
                } else if (e == 'parsererror') {
                    alert('Error.\nParsing JSON Request failed.');
                } else if (e == 'timeout') {
                    alert('Request Time out.');
                } else {
                    alert('Unknow Error.\n' + x.responseText);
                }
            },
            success: function (cidades) {

               // $.each(cidades, function (indice, cidade) {
               //     alert(cidade.Nome + ": " + cidade.Uf);
               // });
            }
                    });

Someone has some idea?

  • 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-27T03:36:02+00:00Added an answer on May 27, 2026 at 3:36 am

    The problem is cross-side scripting. This can easily fixed by using 'jsonp' as dataType.
    And then changing the website to use the ‘”?callback=’ that has been added to the call and wrap that around the json. For example if callback = 'test'

    test('[{"Nome":"AGUAS DE LINDOIA","Uf":"SP"},{"Nome":"AMERICANA","Uf":"SP"},{"Nome":"AMPARO","Uf":"SP"}]')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hi friends i have i am showing some data via ajax on my page
Friends and fellow users, We have both 402 and 403 http response codes. Though,
Friends, I have a question here. I'm developing an VS2010 - MVC 3 Application
Friends, I have about 20-30 datagrids that have different data on all of them.
friends, i have created custom title bar using following titlebar.xml file with code <?xml
Friends, I have a strange need and cannot think my way through the problem.
friends, i have a EditText on simple activity with a button. when every i
Friends, My apex page has several different radio groups, each one can have the
Friends, currently I dont have iphone to test and using Simulator for testing purposes.
friends, i have a custom view class public class Zoom extends View { private

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.