playframework - taking play framework object in a javascript variable -
i have map declared in template parameters following syntax
@(formdata : scala.collection.map[string, scala.list[string]], previousdata : scala.collection.map[string,string], resultlist: scala.list[string])(implicit flash: play.api.mvc.flash)
i want read previousdata map object , want store in javascript variable. want set value in textbox fetching value map object. know can use document.getelementbyid in javascript set value of particular textbox. please help? if other way possible please let me know. tried following method isn't working.
function loadpreviousdata() { if(@previousdata != null) { var x = @{previousdata.getorelse("name",null)}; alert("name " +x); } }
yes can use jquery used nowadays. let's txtname id of textbox can
$("#txtname").val(x);
here x variable in extracts data.
Comments
Post a Comment