Advertisement
Guest User

Untitled

a guest
Feb 14th, 2016
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. <script>
  2. var pdatabase= '{ "pobject" : [' +
  3. '{ "pname":"Pikachu" , "pid":"1" },' +
  4. '{ "pname":"Squirtle" , "pid":"2" },' +
  5. '{ "pname":"Justinbieber" , "pid":"3" }]}';
  6. </script>
  7. <script>
  8. $(function() {
  9. ppdatabase = JSON.parse(pdatabase);
  10. plenth=ppdatabase.pobject.length;
  11. test=console.log(plenth);
  12. });
  13. </script>
  14.  
  15. var pdatabase= '{ "pobject" : [' +
  16. '{ "pname":"Pikachu" , "pid":"1" },' +
  17. '{ "pname":"squirtle" , "pid":"2" },' +
  18. '{ "pname":"Justinbieber" , "pid":"3" }]}';
  19.  
  20. <script src="obdatabase.json"></script>
  21.  
  22. <script>
  23. $(function() {
  24. ppdatabase = JSON.parse(pdatabase);
  25. plenth=ppdatabase.pobject.length;
  26. test=console.log(plenth);
  27. });
  28. </script>
  29.  
  30. <script>
  31. $.get('obdatabase.json', function(pdatabase) {
  32. ppdatabase = JSON.parse(pdatabase);
  33. plenth=ppdatabase.pobject.length;
  34. test=console.log(plenth);
  35. });
  36. </script>
  37.  
  38. {
  39. "pobject": [{
  40. "pname": "Pikachu",
  41. "pid": "1"
  42. }, {
  43. "pname": "squirtle",
  44. "pid": "2"
  45. }, {
  46. "pname": "Justinbieber",
  47. "pid": "3"
  48. }]
  49. }
  50.  
  51. $.getJSON('obdatabase.json', function(pdatabase) {
  52. plenth=ppdatabase.pobject.length;
  53. test=console.log(plenth);
  54. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement