javascript - Uncaught reference Error: <mapkey> is not defined -
$(document).ready(function() { var key = "testkey"; var value = "testvalue"; <apex:repeat value="{!timespent}" var="item"> console.log(key); console.log(value); value = {!timespent[item]}; key = {!item}; console.log(key); console.log(value); </apex:repeat> });
timespent variable coming controller, salesforce map of string decimal:
public map<string, decimal> timespent = new map<string, decimal(); // map gets values via further code works fine
when execute above javascript, console says:
2015-04-01 12:29:11.354cmrp_resourcedashboard:45 testkey 2015-04-01 12:29:11.354cmrp_resourcedashboard:46 testvalue 2015-04-01 12:29:11.356cmrp_resourcedashboard:49 uncaught referenceerror: geblockt not defined
and have no idea why. "geblockt" key map, type string. error shows keys of map, not values. ideas, anyone?
here debug inspector (chrome)
<script>
$(document).ready(function() {
var key = "testkey"; var value = "testvalue"; console.log(key); console.log(value); value = 0; key = geblockt; <---- here error console.log(key); console.log(value); console.log(key); console.log(value); value = 5; key = pr-122; console.log(key); console.log(value);
});
as per example geblockt
treated variable not defined getting error.
assign in quotes treated string:
key = "{!item}";
Comments
Post a Comment