Reputation: 191
I need to access to the inside of the widget and get the options values, in this case the sizeId.
$.widget('mod.sizecurves', {
options: {
sizeId: 0,
jsonUrlInfo: '',
jsonInfo: {}
},
getSizeId: function(){
return this.options.sizeId;
}
});
var sizeId = $.mod.sizecurves('getSizeId');
console.log(sizeId);
In the console I receive an object and i want to only receive the value of sizeId.
Upvotes: 2
Views: 170
Reputation: 1048
The object you get is a json. You have to parse it then access to the wanted param, like so
var obj = $.parseJSON(sizeId);
console.log(obj.options.sizeId);
Upvotes: 1