Advertisement
Guest User

Untitled

a guest
Mar 27th, 2015
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. // define productsData
  2. var productsData;
  3.  
  4. function getProductsData() {
  5. client.invokeApi("category", {
  6. method: "post",
  7. body: {
  8. "latitude": "48.8135560",
  9. "longitude": "2.3928829"
  10. }
  11. }).done(function (results) {
  12. var response = JSON.parse(results.response);
  13.  
  14. // get informations from the API "category"
  15. var productsArray = new Array();
  16. response.forEach(function (i) {
  17. productsArray.push({
  18. Id : i.Id,
  19. restaurant_Id : i.restaurant_Id,
  20. category_Id : i.category_Id,
  21. name : i.name,
  22. image : i.image,
  23. distance : i.distance
  24. });
  25. });
  26.  
  27. // create productsData binding
  28. productsData = new WinJS.Binding.List(productsArray);
  29.  
  30. WinJS.UI.processAll();
  31. });
  32. }
  33. getProductsData();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement