JavaScript Object Syntax error -
JavaScript Object Syntax error -
i trying assemble object form data, i'm pretty sure i'm messing syntax - here's snippet
$device1.u_data.create.nodes.[$('#device-1-ip-1').val()] = {"enabled": true}; $device1.u_data.create.nodes.[$('#device-1-ip-2').val()] = {"enabled": true}; $device1.u_data.create.nodes.[$('#device-1-ip-3').val()] = {"enabled": true}; $device1.u_data.create.nodes.[$('#device-1-ip-4').val()] = {"enabled": true};
i think must messing piece i'm trying pull form. error i'm seeing in console "syntaxerror: missing name after . operator"
anything obvious i'm missing? help much appreciated.
you attempting utilize square bracket notation access items in .nodes
, have dot between "nodes" , open square bracket.
on lines should have like:
$device1.u_data.create.nodes[$('#device-1-ip-1').val()] = {"enabled": true};
notice not have dot after "nodes"
javascript
Comments
Post a Comment