remoteJSON.html 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  5. <script type="text/javascript" src="../build/jsMotif.js"></script>
  6. <title>jsMotif example</title>
  7. </head>
  8. <body>
  9. <div id="template">
  10. <ul each="{results}">
  11. <li>
  12. <span fill={properties.title}></span>
  13. <span fill={properties.addrCityName}></span>
  14. </li>
  15. </ul>
  16. </div>
  17. <script type="text/javascript">
  18. var tpl = new jsMotif.Template({
  19. template: 'template',
  20. targetNode: 'template'
  21. });
  22. //JSONP (cross domain) request, use reqType: 'jsonp' and use {CB_FN} in the url to mark place where callback function name should be placed
  23. tpl.renderJSON('http://where.desktop.mos.svc.ovi.com/NOSe/json?dv=oviMaps&la=en-gb&cbfn={CB_FN}&app_id=&token=&vi=where&q=pizza&lon=13.377678&lat=52.516274&rid=oe79EqeR',
  24. {
  25. reqType: 'jsonp',
  26. timeout: 5000
  27. });
  28. //XMLHTTPREQUEST possible to add timeout and custom headers to request
  29. /*
  30. tpl.renderJSON('data.json', {
  31. timeout: 5000,
  32. headers: {
  33. 'myHeader': 'myHeaderValue'
  34. }
  35. });
  36. */
  37. </script>
  38. </body>
  39. </html>