Please try to write in english. I think you missed to set the xhr-headers for cross-origin posting as the error message says.
On Sat, Apr 26, 2014 at 10:49 AM, 唐宗宇 <[email protected]> wrote: > 我的网页在localhost的apache2服务器端口80 > > neo4j在localhost,端口7474, > > chrome错误提示如下,代码如下,求大大解救 > > > <https://lh6.googleusercontent.com/-METVJxm2gjw/U1ts8p1gLMI/AAAAAAAAABg/nsfAuMsgMH4/s1600/QQ%E6%88%AA%E5%9B%BE20140426161521.png> > > <!DOCTYPE HTML> > <html lang="en"> > <head> > <meta charset="utf-8"> > <title>Demo: dojo/request/xhr</title> > <link rel="stylesheet" href="style.css" media="screen"> > </head> > <body> > <div id="resultDiv">{ > "query" : "MATCH (tom {name: "Tom Hanks"}) RETURN tom", > "params" : { > } > } > <div><label>Server Message:</label><span id="svrMessage">dss > </span></div> > </div> > <textarea cols="150" rows="25" id="text"></textarea><br/> > <button id="button" onclick="dadaHttpRequest()" type="submit">test > </button> > <!-- load dojo --> > <script> > function dadaHttpRequest(){ > if (window.XMLHttpRequest) { > xmlhttp = new XMLHttpRequest; > if (xmlhttp.overrideMimeType) { > xmlhttp.overrideMimeType('text/xml'); > }; > > > } else if (window.ActiveXObject){ > xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); > }; > xmlhttp.onreadystatechange = callback; > xmlhttp.open("POST","http://localhost:7474/db/data/cypher",true); > xmlhttp.setRequestHeader("Accept","application/json; > charset=UTF-8"); > xmlhttp.setRequestHeader("Content-Type","application/json"); > var qus='{query" : "MATCH (tom {name: "Tom Hanks"}) RETURN tom", > "params" : { } }'; > xmlhttp.send(qus); > } > function callback(){ > if (xmlhttp.readyState==4 && xmlhttp.status>=200&&xmlhttp.status< > 300) > { > var responseText = xmlhttp.responseText; > document.getElementById("svrMessage").innerHTML=responseText; > } > } > </script> > </body> > </html> > > > > > > > -- > You received this message because you are subscribed to the Google Groups > "Neo4j" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Neo4j" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
