top of page
Forum Posts
cristi ciorba
Jan 29, 2019
In Coding with Velo
// For full API documentation, including code examples, visit http://wix.to/94BuAAs
import {session} from 'wix-storage';
import wixData from 'wix-data';
var kw1,kw2,nm1,nm2;
$w.onReady(function () {
//TODO: write your page related code here...
let res = session.getItem('id'); //Where result will be a string
console.log(res);
$w("#car").setFilter( wixData.filter()
.eq("typ",res))
$w("#car").getItems(0, 1)
.then( (result) => {
let items = result.items;
kw1 =(items[0].chip3_kW-items[0].kW)/(items[0].kW/100);
nm1 =(items[0].chip3_nm-items[0].nm)/(items[0].nm/100);
console.log(kw1);
console.log(nm1);
let totalCount = result.totalCount;
let offset = result.offset;
} )
.catch( (err) => {
let errMsg = err.message;
let errCode = err.code;
} );
//Add your code for this event here:
});
export function button1_click(event) {
$w("#html1").postMessage("kw1");
$w("#html2").postMessage("nm1");
} kw1 and nm1 return undefined outside of the getItems function. I need to use these values in my html component.
0
3
208
cristi ciorba
More actions
bottom of page