<h:outputScript library="js" name="jquery-1.11.0.min.js"></h:outputScript>
<script>
//<![CDATA[
function loadSomething() {
$.ajax({
type: "POST",
url: "#{testBean.LoadThat}",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(datas) {
alert(datas.d);
}
});
}
//]]>
</script>
</h:head>
<body>
<h:form>
<h:inputText id="someText" />
<p:commandButton value="Ajax Submit" id="ajax" update="someText"
onclick="loadSomething();" />
</h:form>
</body>
I'm trying to do a simple task with JSF. I used this exact code on Asp.net and i couldnt be sure what should i do to make this work. Any idea what should i write to 'url' to call bean's method?