I have a JSON open weather issue that I need help with. I have read through a lot of documentation and it all seems different and don't know what to use to make this work. I have an element that is read only and I need to put into that field a JSON data. I have this running on another system so I know it works. I found Fabrik and it offers some things that my other system doesn't, so I am seeing if I can create what I am building on Fabrik.
Here is my code. This is under Javascript of the element
function weatherforecast() {
var q = form_2.formElements.get('property_logs___weather').getValue();
var t = jQuery.getJSON('link_to_api',
function(data) {
var obj = data;
if(q ===''){
q = "Forecast: "+obj.main.temp+"?C "+obj.weather[0].description;
}
});
form_2.formElements.get('property_logs___weather').update(q);
}
I had to take out the link as this forum won't let me add the api, but I do know it works.
Here is my code. This is under Javascript of the element
function weatherforecast() {
var q = form_2.formElements.get('property_logs___weather').getValue();
var t = jQuery.getJSON('link_to_api',
function(data) {
var obj = data;
if(q ===''){
q = "Forecast: "+obj.main.temp+"?C "+obj.weather[0].description;
}
});
form_2.formElements.get('property_logs___weather').update(q);
}
I had to take out the link as this forum won't let me add the api, but I do know it works.