Advertisement
Guest User

Untitled

a guest
Apr 20th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. function callback(results, status) {
  2. var attractions = $("#attractions");
  3.  
  4. if (status == google.maps.places.PlacesServiceStatus.OK) {
  5. for (var i = 0; i < results.length; i++) {
  6. places = results;
  7. var place = results[i];
  8. createMarker(place);
  9. attractions.append("<ul style='display: block' id='" + i + "'>" + place.name + "</ul>");
  10. if (place.hasOwnProperty('photos') && place.photos.length > 0) {
  11. attractions.children(":last").append("<li> <img src='" + place.photos[0].getUrl({
  12. 'maxWidth': 75,
  13. 'maxHeight': 50
  14. }) + "'/>" + "</li>");
  15. attractions.children(":last").find('li').toggle();
  16. }
  17. $.ajax({
  18. type: "POST",
  19. url: "/api/attraction",
  20. contentType: "application/json; charset=utf-8",
  21. dataType: "json",
  22. data: JSON.stringify({
  23. attraction: {
  24. "name":"cos",
  25. "cost": 1.23
  26. }
  27. }),
  28. success: function () {
  29. console.log(attraction.cost + attractions.name);
  30. },
  31. error: function () {
  32. console.log("Error during POST");
  33. }
  34. });
  35.  
  36. }
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement