Loading

JSON looped data - WORKS

  1. <%@ LANGUAGE=VBScript %>
  2. <!--#INCLUDE FILE="aspJSON1.16.asp"-->
  3. <%
  4.  
  5. ' Set the page content headers
  6. Response.ContentType = "application/json"
  7. Response.Charset = "UTF-8"
  8.  
  9. ' Set the default response
  10. Set oJSONResponse = New aspJSON
  11. oJSONResponse.data("result") = "OK"
  12. oJSONResponse.data("details") = "JSON data parsed successfully"
  13. oJSONResponse.data("action") = "wtf"
  14.  
  15. ' Create the fieldPoints collection
  16. Set oJSONResponse.data("fieldPoints") = oJSONResponse.Collection()
  17.  
  18. ' Start the loop
  19. x = 1
  20. Do Until x = 5000
  21.  
  22.     Response.Write """fieldName"", ""field name here (x="&x&")""" & VbCrLf
  23.     Response.Write """fieldID"", ""field id here (x="&x&")""" & VbCrLf
  24.     Response.Write """fieldArea"", ""field area here (x="&x&")""" & VbCrLf
  25.     Response.Write """lat"", ""lat here (x="&x&")""" & VbCrLf
  26.     Response.Write """long"", ""long here (x="&x&")""" & VbCrLf
  27.     Response.Write VbCrLf
  28.  
  29. '    Set newitem = oJSONResponse.AddToCollection(oJSONResponse.data("fieldPoints"))
  30. '    newitem.add "fieldName", "field name here (x="&x&")"
  31. '    newitem.add "fieldID", "field id here (x="&x&")"
  32. '    newitem.add "fieldArea", "field area here (x="&x&")"
  33. '    newitem.add "lat", "lat here (x="&x&")"
  34. '    newitem.add "long", "long here (x="&x&")"
  35.  
  36.     x = x + 1
  37.     Response.Flush
  38. Loop
  39.  
  40. ' Write the response
  41. Response.Write oJSONResponse.JSONoutput()
  42.  
  43. ' Clean up
  44. Set oJSONResponse = nothing
  45.  
  46. %>

Comments