[Solved] Help me in working with json | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

[Solved] Help me in working with json

I am working with api using jquery $.getJSON() but it not working well...help me to understand. https://code.sololearn.com/W2AArtvMfPpf/?ref=app I have url in code you can search it for json , which i am requesting for...it is giving json there in browser but not in code on sololearn...

19th Jan 2021, 2:38 PM
Divya Mohan
Divya Mohan - avatar
8 Answers
+ 2
In code "ipadress", at line 24 change data.i to data[i]
19th Jan 2021, 3:43 PM
ODLNT
ODLNT - avatar
+ 3
Would you explain data[i] 🤔🤔
19th Jan 2021, 3:56 PM
Divya Mohan
Divya Mohan - avatar
+ 2
Error message from developers console "Mixed Content: The page at 'https://code.sololearn.com/W2AArtvMfPpf/?ref=app' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://www.7timer.info/bin/civil.php?lon=113.2&lat=23.1&ac=0&unit=metric&output=json&tzshift=0'. This request has been blocked; the content must be served over HTTPS."
19th Jan 2021, 3:30 PM
ODLNT
ODLNT - avatar
+ 2
It means it was due to reason that sololearn has https... and that json has http... ha!!! Thanks for explanation sir. By the here i have next try a bit closer to result but not properly think due to same error...
19th Jan 2021, 3:38 PM
Divya Mohan
Divya Mohan - avatar
+ 1
https://code.sololearn.com/W80JUe50yv9A/?ref=app in this code i have request over https.... json but it showing undefined...would you help me here...
19th Jan 2021, 3:39 PM
Divya Mohan
Divya Mohan - avatar
+ 1
Use bracket notation, because it is the correct way to access the object that is being iterated . https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...in
19th Jan 2021, 4:18 PM
ODLNT
ODLNT - avatar
+ 1
Thanks ODLNT
19th Jan 2021, 4:21 PM
Divya Mohan
Divya Mohan - avatar
+ 1
No problem, I'm glad I could help.
19th Jan 2021, 4:22 PM
ODLNT
ODLNT - avatar