i have list of data available this
data((33,54.4445,66.44,77.44)) data((33,54.4445,66.44,77.44)) data((33,54.4445,66.44,77.44)) data((33,54.4445,66.44,77.44))
i have put mark-up of html page. need way can read same in javascript html mark up. tried - <input type="hidden" value="data((33,54.4445,66.44,77.44)) , data((33,54.4445,66.44,77.44)) , data((33,54.4445,66.44,77.44))" />
and, tried read wanted field this-
$.each(myarray.split(','), function(index, value) { myjavascript_function(value) });
problem- using above javascript
, unable obtain above mentioned list of data.
question- how put data list in markup able data list in javascript/jquery
array
or plain object
or other format?
u can try value="{'data':['data((33,54.4445,66.44,77.44))' , 'data((33,54.4445,66.44,77.44))' , 'data((33,54.4445,66.44,77.44))']}"
html attribute
, in javascript
var myplainobject = json.parse($("someselector").attr("value"));
here, myplainobject
plain object.
var mayarray = myplainobject .data;
u r correct, format not become wat give in html attr
(it coming string
in case) so, have use json.parse()
plain object
out of string
.
Comments
Post a Comment