Loading

JSON looped data - FAILS

  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 = 2500
  21.     Set newitem = oJSONResponse.AddToCollection(oJSONResponse.data("fieldPoints"))
  22.     newitem.add "fieldName", "field name here (x="&x&")"
  23.     newitem.add "fieldID", "field id here (x="&x&")"
  24.     newitem.add "fieldArea", "field area here (x="&x&")"
  25.     newitem.add "lat", "lat here (x="&x&")"
  26.     newitem.add "long", "long here (x="&x&")"
  27.     x = x + 1
  28.     Response.Flush
  29. Loop
  30.  
  31. ' Write the response
  32. Response.Write oJSONResponse.JSONoutput()
  33.  
  34. ' Clean up
  35. Set oJSONResponse = nothing
  36.  
  37. %>

Version history

Revision # Author Created at
pjkazukuf Rich 27 Feb 2014, 15:44:03 UTC Diff

Comments