javascript - spring mvc jquery map,array -


in spring mvc application, have dynamic buttons.

<input type="button" id="button${id}" class="btn register" value="add option" onclick="processid(${id})"/> 

based on click action above number of buttons increase. have buttons button1,button2,button3,button4 etc.

now click on each button calling processid(id) function passing id value.

on processid(id) function doing call spring controller. passing 2 parameter, id , increment of variable. struggling, second parameter.

function processid(id) {     $.get("<%=request.getcontextpath()%>/processid", { id: id,secondid:secondid,},     function(data){         $("#submitidoptionrow"+id).before(data);     }); } 

how increase secondid value click event of 1 id. suppose click on
button2 - 1st click - parameter 2,0 - 2nd click - paramter 2, 1 - 3rd click - paramter 2, 2

button3 - 1st click - parameter 3,0 - 2nd click - paramter 3, 1

looks need double dimension array/ map, key-value pair.where id key , value second parameter. if id(button2) available on map, value (second parameter) , increase 1 more else id(button2) not available.then put in array both key , value(2,0)

this kind of logic can handle in java using util map.but in jquery poor. please me, how achieve this.

if map function alone problem, in javacript have map function. please check mdn documentation.

from browser compatability stand point, supported in ie 9+


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -