JSONP web service

I am trying to call a web service that returns jsonp from percussion. I have a web service (a microsoft example) installed on IIS on my machine.

When I put…

in my browser, I get back

{“d”:{"__type":“Customer:#Microsoft.Samples.Jsonp”,“Address”:“1 Example Way”,“Name”:“Bob”}}

When I try to call the service from my webpage, though something doesn’t work. The call in my webpage looks like this inside an HTML widget:

Old Text

Click Me!

When I click the button I do see the text change to “ready to get json”, but I am expecting the text to then change to
{“d”:{"__type":“Customer:#Microsoft.Samples.Jsonp”,“Address”:“1 Example Way”,“Name”:“Bob”}}
or something like that.

Is res a string? Do I need to parse it?

I even tried to just put a different text message in ( $("#response").html(“this worked”); ) but that didn’t work either. So I think I’m not getting into the function.

How can I get the web service response so that I can process it?

OK. I figured it out. I needed to add callback=? to the getjson call, and parse the result. And I see that my original HTML didn’t make it into the previous post.

The correct HTML is


* Old Text

* Old Text

*Click Me!

OK, how do I add HTML to this box??

Hey Peggy,

You can include HTML samples on this forum by wrapping the code in tags like this:

 HTML code goes here. 

Thanks for taking the time to share your solution!

$.getJSON( '', null, function(res){ <br /><br /> $("#response").html("it worked"); <br /> console.log(res);
            // log the result from the callback <br />
$.each(res, function(key, val) { <br /> $("#response1").html(key); <br /> $("#response2").html(val); <br /><br /> }); <br /><br /> }); <br /> }; <br /><br /> </script>

Old Text


Old Text

 <button type="button" onclick="myFunction()">Click Me!</button>```