Sokolee / aspjson

Automatically exported from code.google.com/p/aspjson
0 stars 0 forks source link

JSONP #31

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
It would be nice if it supported JSONP.  I only takes a simple edit to 
automatically output JSON or JSONP as required. I only tested this for a second 
and from the same server but it seems to work fine.

Sub Flush
   If TypeName(Response) <> "Empty" Then 
      If Request.QueryString("callback").Count Then
         'JSONP Response
         Response.ContentType = "application/javascript"
         Response.Write Request.QueryString("callback") & "(" & jsString & ")"
      Else
         'JSON Response
         Response.ContentType = "application/json"
         Response.Write(jsString)
      End If
   ElseIf WScript <> Empty Then 
      WScript.Echo(jsString)
   End If
End Sub

Original issue reported on code.google.com by csand...@wastedhalo.com on 18 Feb 2013 at 3:11