Advertisement
Guest User

Untitled

a guest
Mar 30th, 2015
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)
  2.  
  3. for (var key in validation_messages) {
  4. if (validation_messages.hasOwnProperty(key)) {
  5. var obj = validation_messages[key];
  6. for (var prop in obj) {
  7. // important check that this is objects own property
  8. // not from prototype prop inherited
  9. if(obj.hasOwnProperty(prop)){
  10. alert(prop + " = " + obj[prop]);
  11. }
  12. }
  13. }
  14. }
  15.  
  16. var validation_messages = {
  17. "key_1": {
  18. "your_name": "jimmy",
  19. "your_msg": "hello world"
  20. },
  21. "key_2": {
  22. "your_name": "billy",
  23. "your_msg": "foo equals bar"
  24. }
  25. }
  26.  
  27. var validation_messages = {
  28. "key_1": {
  29. "your_name": "jimmy",
  30. "your_msg": "hello world"
  31. },
  32. "key_2": {
  33. "your_name": {
  34. "first_name" : "Ratan",
  35. "secound_name" : "Tata",
  36. },
  37. "your_msg": "foo equals bar"
  38. }
  39. }
  40.  
  41. "your_name = jimmy"
  42. "your_msg = hello world"
  43. "your_name = [object Object]"
  44. "your_msg = foo equals bar"
  45.  
  46. var validation_messages = {
  47. "key_1": {
  48. "your_name": "jimmy",
  49. "your_msg": "hello world"
  50. },
  51. "key_2": {
  52. "your_name": {
  53. "first_name" : "Ratan",
  54. "secound_name" : "Tata",
  55. },
  56. "your_msg": "foo equals bar"
  57. }
  58. }
  59.  
  60.  
  61. for (var key in validation_messages) {
  62. if (validation_messages.hasOwnProperty(key)) {
  63. var obj = validation_messages[key];
  64. for (var prop in obj) {
  65. // important check that this is objects own property
  66. // not from prototype prop inherited
  67.  
  68. if(typeof prop != 'string') {
  69. for(var obj_key in prop) {
  70. var obj = prop[obj_key];
  71. for (var prop in obj){
  72. console.log(prop + " = " + obj[prop]);
  73. }
  74. }
  75. }
  76.  
  77. if(obj.hasOwnProperty(prop)){
  78. console.log(prop + " = " + obj[prop]);
  79. }
  80. }
  81. }
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement