IndexControllerにtest()というパブリック関数があると仮定します。
public function test(){
//some code here
}
index.phtmlビューファイルで、JQUERY AJAXを使用してtest()関数を呼び出したいのですが、これについてはわかりません。
コード:
<a href="javascript:void(0)" onclick="callTestFunction()">Click me to call test() function()</a>
<script>
callTestFunction = function(){
$.ajax({
type: "POST",
Url: ***//WHAT SHOULD BE HERE***
Success: function(result){
alert('Success');
}
});
}
</script>