0
I'm trying to get some j son data from a local server using Senchatouch-2 app:   

我收到以下消息:

load http://localhost:8084/Sencha/senchatest. Origin http://localhost:8084 is not allowed by Access-Control-Allow-Origin.

Even If I launch my sencha app as an, I get this:

   XMLHttpRequest cannot load http://localhost:8084/Sencha/senchatest.Origin null is not allowed by Access-Control-Allow-Origin

The web service returns data. I try to catch the data items like this:

// 动态列表视图

 proxy:{
            type: 'ajax',
            method:'GET',
            model:'List.model.Mainmodel',
            url: 'http://localhost:8084/Sencha/senchatest',

            reader: {
                type: 'json',
                rootProperty: 'data.firstName.lastName'
              }}  

And I'm trying to get this structure:
   {"data":[{"firstName": "dhina", "lastName": "karan"},{"firstName": "dhina", "lastName": "karan"},{"firstName": "dhina", "lastName": "karan"},{"firstName": "dhina", "lastName": "karan"},{"firstName": "dhina", "lastName": "karan"},{"firstName": "dhina", "lastName": "karan"}]}

你知道我为什么会收到这个错误吗?

谢谢,

问候

4

2 回答 2

0

确保您已通过服务器获取您的页面,而不是通过文件系统加载它

于 2012-11-07T06:46:41.897 回答
0

您正遭受同源政策的困扰。

通过这个:https ://developer.mozilla.org/en-US/docs/Same_origin_policy_for_JavaScript

这也将对您有所帮助:https ://developer.mozilla.org/en-US/docs/HTTP_access_control

于 2012-11-07T06:41:03.197 回答