The url I'm trying to fetch the data from:
"https://blob.niftyindices.com/jsonfiles/SectorialIndex/SectorialIndexDataNIFTY%20AUTO.js"
The response is a .js file. When I opened the file, this is the data I got:
modelDataAvailable({
"groups": [{
"label": "ASHOKLEY 2.8%",
"weight": 2.8,
"id": "1"
}, {
"label": "BHARATFORG 3.5%",
"weight": 3.5,
"id": "2"
}, {
"label": "BAJAJ-AUTO 9.61%",
"weight": 9.61,
"id": "3"
}, {
"label": "BALKRISIND 2.16%",
"weight": 2.16,
"id": "4"
}, {
"label": "BOSCHLTD 2.23%",
"weight": 2.23,
"id": "5"
}, {
"label": "EICHERMOT 5.82%",
"weight": 5.82,
"id": "6"
}, {
"label": "HEROMOTOCO 6.65%",
"weight": 6.65,
"id": "7"
}, {
"label": "M&M 16.38%",
"weight": 16.38,
"id": "8"
}, {
"label": "MARUTI 14.9%",
"weight": 14.9,
"id": "9"
}, {
"label": "MOTHERSON 2.98%",
"weight": 2.98,
"id": "10"
}, {
"label": "MRF 3.22%",
"weight": 3.22,
"id": "11"
}, {
"label": "SONACOMS 2.81%",
"weight": 2.81,
"id": "12"
}, {
"label": "TATAMOTORS 17.25%",
"weight": 17.25,
"id": "13"
}, {
"label": "TIINDIA 4.51%",
"weight": 4.51,
"id": "14"
}, {
"label": "TVSMOTOR 5.16%",
"weight": 5.16,
"id": "15"
}, ]
}, {
label: "NIFTY AUTO ",
file: "SectorialIndexDataNIFTY AUTO.jsonp "
});
Now, my question is that the data is coming in the form of a function and not an object. So, how should I actually get the data in the object form so I can display that in the browser?