i have implemented different solution of this problem but i am unable to access the controller method from jsp some solution that i have used are following
<script type="text/javascript">
var entryId = arguments[0];
function callMetod()
{
<%!public void clickBtn() {
ControllerJSP controller = new ControllerJSP();
controller.likePicture();
}%>
}
</script>
solution 2 is
<script type="text/javascript">
var entryId = arguments[0];
function callMetod()
{
var entryId = arguments[0]
$.post( "../controllerJSP/LikePicture", {eid: 232 })
.done(function( data ) {
alert( "Data Loaded: " + data );
});
</script>
Solution three that i can implemented is
<script type="text/javascript">
function callMetod()
{
`
var f={};
var response = "4292";
f.url = "../controllerJSP/LikePicture";
f.type = "POST";
f.dataType = "json";
f.data={eId:entryId};
f.contentType = "application/json";
f.success = function (entryId) {
console.log(json)
alert("success");
};
f.error = function (){
alert("failed");
};
$.ajax(f);
alert("run")
}
</script>
please help me to resolve this issue