Ajax only works properly if the application is hosted on the CMIS repository because of the same origin policy. The hidden frame approach works even if the application is served from a different host.
Here is an example:
<script type="text/javascript">
function createCallback() {
...
}
</script>
<form action="..." method="POST" target="createResult">
...
</form>
<iframe name="createResult" style="display:none;" onload="createCallback()"></iframe>
Here is a complete example: https://svn.apache.org/repos/asf/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings-war/src/main/webapp/web/index.html