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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:44:29+00:00 2026-06-01T00:44:29+00:00

I could use another set of eyes – perhaps I am missing somehting obvious.

  • 0

I could use another set of eyes – perhaps I am missing somehting obvious. I wrote a WCF service to return some basic data from my sql server database. It seems to function just fine. Now I am simply trying to dump that data to my webpage like this:

<script type="text/javascript">
  $.ajax({ url: 'http://localhost:35798/restserviceimpl.svc/json/999?callback=?',
    dataType: "jsonp",
    success: function (data) {
        alert(data); 
        $.each(data, function (i, item) {
            $('#gallery').append('<p>' + i + '.'+ item + '</p>');
        });
    }
  });
</script>

Using fiddler, it looks to me like correctly format json data is being returned to my webpage (and the alert shows me what looks json data which validates on jsonlint.com), but when I try to iterate over it I simply get one character for each ‘each’, instead of ‘records’. I get 800+ iterations, each containing just one character of the JSON string, instead of the approximate 17 ‘records’ of json data, each with two fields.

So am I getting a string back from my WCF that just ‘looks like’ JSON, or is my jquery script above have a bug?

  • 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-06-01T00:44:31+00:00Added an answer on June 1, 2026 at 12:44 am

    Well, took me almost 2 days of trial an error, not sure if I had the problem on the WCF end or the jQuery end, but this is what I ended up with and works:

    <script type="text/javascript">
    $(function () {
        $.ajax({
            url: 'http://localhost:35798/restserviceimpl.svc/json/999',
            type: 'GET',
            dataType: 'jsonp',
            success: function (data) {
                var obj = $.parseJSON(data);
                $.each(obj, function (i, item) { $('#gallery').append('<p>' + item.Id + '.' + item.Name + '</p>'); });
            }
        });
    });
    

    for some reason, which I don’t fully understand, I had to add the $.parseJSON(data) line in order to convert the ‘JSONP’ string that was coming down from my WCF service, into useable JSON in order to be able to iterate over it. It is odd, because I consume JSONP from other places in this app, and didn’t have to do this, so it is possible my WCF is sending slightly malformed results, that I need to compensate for in my jQuery, but until I figure out if that is true I am just going to go with what works.

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

Sidebar

Related Questions

I'm working alone on this project and could use another set of eyes to
Having some trouble with the Migrations in Sequel and could use another set of
I could really use another set of eyes on this so I thought I
I could use another pair of eyes. This script does what I want in
I could use some help with expression conversion. I have a method on a
I am really new to Ruby and could use some help with a program.
I have a design conundrum that I could use some feedback on, so I'm
I could use a bit of help with this, as i am new to
could someone help me with the regex pattern that i could use to match
It seems like you could use a mashup of Relector and a Debugger to

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.