1

I've modified my WebAPI to return JSONP, but how can I tell if it's really JSONP and not regular JSON? I understand that the "P" stands for Padding. Is there a physical, readable difference between JSON and JSONP?

Mike Marks
  • 10,017
  • 17
  • 69
  • 128

1 Answers1

2

jsonp will be in the form of this: (returned by the server of course)

"callbackFunction( { jsonSyntax } );"

jsonp is just JSON but with a callback javascript function wrapping it.

T McKeown
  • 12,971
  • 1
  • 25
  • 32
  • So the string that my WebAPI returns, should the callback function start the string? – Mike Marks Dec 27 '13 at 14:58
  • You must remember my question from yesterday! :) Yes, I will be calling it from Ajax, but for testing purposes, I'm navigating straight to the WebAPI's URL, and the JSON is outputted to my browser window. If I understand you correctly, the JSON I see in my browser should have the callback function at the beginning, right? – Mike Marks Dec 27 '13 at 15:01
  • yes. the wep api content type should be set to json also. typically I send the callback in the query string to the server, then I generate my json.. ultimately i respond back with "( );" – T McKeown Dec 27 '13 at 15:04