Advertisement
Guest User

Untitled

a guest
Jun 29th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. <script>
  2. var photoarray = [];
  3. var ajaxRequest = $.ajax
  4. ({
  5. url : "fhs_get_photos.php",
  6. type: "POST",
  7. dataType: "json",
  8. success: function(photo_array)
  9. {
  10. photoarray = photo_array;
  11. //line below works. the file name is correct but disappears
  12. //outside of this function
  13. console.log("photoarray[0][file_name] is: " + photoarray[0]['file_name']);
  14. },
  15.  
  16. error: function(request, status, error)
  17. {
  18. alert('An error occurred: ' );
  19. }
  20. });
  21.  
  22. // in fhs_get_photos.php
  23. // SELECT * FROM table......
  24. echo $json = json_encode($result);
  25. return $json;
  26.  
  27. <h3>Welcome to the Historical Society's historical photo archive
  28. </h3>
  29. </header>
  30. <figure id="photo_figure">
  31. <script>
  32. //line below gets me: SCRIPT5007: Unable to get property 'thumb' of
  33. //undefined or null reference
  34. console.log("photoarray thumb: ") + photoarray[0]['thumb'];
  35. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement