开发者

use Node.js to send a json request from client to the server

开发者 https://www.devze.com 2023-03-22 19:21 出处:网络
i have a grails project works as a server. it receives a reques开发者_开发知识库t from another javascript project. this request is json request.

i have a grails project works as a server. it receives a reques开发者_开发知识库t from another javascript project. this request is json request.

problem: server doesn't receive any request i try to use node.js, how can i use it?

Note: in the url mapping of the grails server project i declare this url and to access specific action in specific controller

thanks


Browsers will not allow you to issue ajax requests to a URL in a different domain. If that client code you posted is, as you say in a comment, in a "file:" URL on your machine, then the browser will not allow access to those "http://localhost" URLs via XMLHttpRequest (the innards of "$.ajax()"). It's called the "same origin policy."

If you could serve up your test page from a "http://localhost:8058" URL, then you'd be able to talk to the server.


Make sure there is a file jquery-1.6.2.js in the same directory as the .html file.

0

精彩评论

暂无评论...
验证码 换一张
取 消