07-30-2012 12:05 PM
<html>
<head>
<title>Simple Ajax Example</title>
<script language="Javascript">
function xmlhttpGet() {
var strURL="http://isxpre76:8080/alfresco/service/api/login?u='+document.getElementById('login').value+'&pw='+do...;
var xmlHttpReq = true;
var self = this;
// Mozilla/Safari
if (window.XMLHttpRequest) {
self.xmlHttpReq = new XMLHttpRequest();
}
// IE
else if (window.ActiveXObject) {
self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
}
self.xmlHttpReq.open('GET', strURL, false);
self.xmlHttpReq.setRequestHeader('Content-Type', 'application/xml');
self.xmlHttpReq.send();
updatepage("sdsddssd"+self.xmlHttpReq.responseXML);
}
function updatepage(str){
document.getElementById("result").innerHTML = "<h1>"+str+"</h1>";
}
</script>
</head>
<body>
<form name="f1">
<p>login: <input id="login" name="login" type="text"></p>
<p>password: <input id="password" name="password" type="text">
<input value="Go" type="button" onclick='JavaScript:xmlhttpGet()'></p>
<div id="result"></div>
</form>
</body>
</html>
07-31-2012 04:56 AM
test.html:34
XMLHttpRequest cannot load http://localhost:8080/alfresco/service/api/login?u=admin&pw=admin. Origin null is not allowed by Access-Control-Allow-Origin.
Uncaught Error: NETWORK_ERR: XMLHttpRequest Exception 101 test.html:19
xmlhttpGet test.html:19
onclick test.html:34
2012-07-31 10:54:18,042 ERROR [extensions.webscripts.AbstractRuntime] [http-8080-1] Exception from
executeScript - redirecting to status template error: 06310004 Script url /api/login does not suppor
t the method OPTIONS
org.springframework.extensions.webscripts.WebScriptException: 06310004 Script url /api/login does n
ot support the method OPTIONS
at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.j
ava:179)
at org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServl
et.java:118)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j
ava:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.j
ava:58)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j
ava:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:470)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.ja
va:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:619)
08-01-2012 05:00 AM
08-03-2012 04:15 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.