hau
未讀,2010年10月26日 清晨6:30:282010/10/26登入以回覆作者
登入以轉寄訊息
你的權限不足,無法在這個群組刪除訊息
登入以檢舉訊息
該群組的電子郵件地址為匿名,或你需要檢視成員電子郵件地址的權限才能查看原始貼文
收件者:JavaScriptMVC
I'm doing development work for a web app using jmvc3. My app will use
ajax to fetch data from a server. The design will have these remote
resources coming from a domain different from the app itself. So,
we'll use a browser that supports CORS and have the remote server also
providing that support.
In development mode, I point my browser to a file:/// url of the app.
It then calls ajax to a remote server which returns data in json.
That's fine. But when data comes back, the javascript breaks with
this error when it tries to render a view:
XMLHttpRequest cannot load file:///Users/hau/lab/jmvc3/myapp/views/reading/page.ejs.
Origin null is not allowed by Access-Control-Allow-Origin.
I did some search on the web and it looks like the reason of this
error is because the app is served at a file:/// url. Supposedly this
can be solved by access the app at a http url.
So, my question is: how can a jmvc3 app in development mode be
deployed on a web server? I'd appreciate anyone's sharing some
success stories on this. It would be even better if the web server is
a rails app, i.e. rails app; app/script/server to bring up the
server. Thanks!