将JSON公开为jQuery可查询的

时间:2023-01-15 15:55:04

I am trying to expose some data, user names, as json format on my server. I want to use jQuery.getJSOn() method to query data. I can get my data converted to json with newtonsoft.dll on server and save it in a file. But as far as I know it is not queryable. I want something like

我正在尝试在我的服务器上公开一些数据、用户名作为json格式。我想使用jQuery.getJSOn()方法查询数据。我可以用newtonsoft将我的数据转换成json。将dll保存在服务器上。但据我所知,这是不可查询的。我想要这样

http://search.twitter.com/search.json?callback=?&q=abc

http://search.twitter.com/search.json?callback=?&q=abc

Can anyone help me out to expose my data ion the above format.

谁能帮我把上面格式的数据公开出来吗?

1 个解决方案

#1


2  

if you want to serve static JSON files your .dll produces, just put them in a folder on your web server.

如果您想要为.dll生成的静态JSON文件提供服务,只需将它们放在web服务器上的文件夹中。

Or code a web service that spits out JSON

或者编写出JSON的web服务

if you put the files in a folder called json on example.com, and you calling getJSON from the same server, you should be good.

如果您将文件放在example.com上名为json的文件夹中,并从同一台服务器调用getJSON,那么您应该做得很好。

If you are asking how to generate web services, you need better tagging on this site.

如果您正在询问如何生成web服务,您需要在这个站点上进行更好的标记。

::ADDITIONAL RESPONSE::

::额外的反应::


jQuery.getJSON('datanew.json',function (data) {
    var obj,i,dataLen,maxLen;
    maxLen = 5;
    i = 0;
    dataLen = data.length;
    do {
        if ( data[i].Name !== undefined ) {
            alert ( data[i].Name ); 
        }
        i = i + 1;
    } while ( i < dataLen && i < maxLen );
});

#1


2  

if you want to serve static JSON files your .dll produces, just put them in a folder on your web server.

如果您想要为.dll生成的静态JSON文件提供服务,只需将它们放在web服务器上的文件夹中。

Or code a web service that spits out JSON

或者编写出JSON的web服务

if you put the files in a folder called json on example.com, and you calling getJSON from the same server, you should be good.

如果您将文件放在example.com上名为json的文件夹中,并从同一台服务器调用getJSON,那么您应该做得很好。

If you are asking how to generate web services, you need better tagging on this site.

如果您正在询问如何生成web服务,您需要在这个站点上进行更好的标记。

::ADDITIONAL RESPONSE::

::额外的反应::


jQuery.getJSON('datanew.json',function (data) {
    var obj,i,dataLen,maxLen;
    maxLen = 5;
    i = 0;
    dataLen = data.length;
    do {
        if ( data[i].Name !== undefined ) {
            alert ( data[i].Name ); 
        }
        i = i + 1;
    } while ( i < dataLen && i < maxLen );
});