Skip to content

Instantly share code, notes, and snippets.

@slamdev
Created March 20, 2014 13:36
Show Gist options
  • Save slamdev/9663863 to your computer and use it in GitHub Desktop.
Save slamdev/9663863 to your computer and use it in GitHub Desktop.
jsf javascript ajax jquery
FacesContext f = FacesContext.getCurrentInstance();
String viewState = f.getApplication().getStateManager().getViewState(f)
$.ajax({
type : "POST",
url : "http://localhost:8080/web/index.xhtml",
headers : {
"Faces-Request" : "partial/ajax"
},
data : {
"javax.faces.ViewState" : "#{bean.viewState}",
"javax.faces.partial.render" : "jsf-element-id-to-render-response",
"javax.faces.partial.ajax" : true
}
}).done(function(e) {
console.log("done", e);
}).fail(function(e) {
console.log("fail", e);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment