I'm having troubles when using jQuery Ajax for loading content - I get an error when trying to load a page using the statement below:
$.ajax({
url : "/shop/ajax/category/" + id,
success : onCategoryLoaded,
dataType : "html"
});
If the page I'm is plain html then everything is fine - however if I include a ui:composition
tag so I can use ui:repeat
and so on, then it fails due to 'unrecognized expression'.
What am I doing wrong?
Thanks in advance.
Make sure that you have included all the required taglib at the beginning of the jsf
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets">
And this may be helpful:
If you are using jQuery1.9, the problem may lie in the content being loaded. There is a new update which requires that the first character in the response be a < [AKA the less than symbol]. Even whitespace will cause this to break and throw the dreaded "Uncaught Error: Syntax error, unrecognized expression:" error.
I'd recommend checking this before using the suggested workaround above. Its not a bug its a security effort.
http://jquery.com/upgrade-guide/1.9/#jquery-htmlstring-versus-jquery-selectorstring