javascript - How to pass a link value from a HTML page to rest web service -


if have html or jsp page having list of sports below.

tennis
football
hockey
cricket

all these 4 should link. if click on of them should return details wherever clicked. need pass sport name rest client pass parameter rest service.

my question how pass value of link whichever clicked html page java application pass text box or check box values html using form action? or there better approach, please suggest

i suggest @ jquery.ajax. you'll want create xhr (get, post etc depending on rest client configuration) , send data.

here crude example on subject;

$('.sports').on('click', function() {    var clickedelementtext = $(this).text();    $.ajax({      url: "/your/endpoint/url",      method: "post",      data: {          sportname : clickedelementtext;      },    }).success(function( response ) {      /* success callback */    }).failure(function( jqxhr, textstatus ) {      /* failure callback */    }); }