<legend id='4B7pD'><style id='4B7pD'><dir id='4B7pD'><q id='4B7pD'></q></dir></style></legend>
    • <bdo id='4B7pD'></bdo><ul id='4B7pD'></ul>

      <small id='4B7pD'></small><noframes id='4B7pD'>

    1. <tfoot id='4B7pD'></tfoot>

      1. <i id='4B7pD'><tr id='4B7pD'><dt id='4B7pD'><q id='4B7pD'><span id='4B7pD'><b id='4B7pD'><form id='4B7pD'><ins id='4B7pD'></ins><ul id='4B7pD'></ul><sub id='4B7pD'></sub></form><legend id='4B7pD'></legend><bdo id='4B7pD'><pre id='4B7pD'><center id='4B7pD'></center></pre></bdo></b><th id='4B7pD'></th></span></q></dt></tr></i><div id='4B7pD'><tfoot id='4B7pD'></tfoot><dl id='4B7pD'><fieldset id='4B7pD'></fieldset></dl></div>

        如何在经典 ASP 中返回 JSON 对象

        时间:2023-10-13

        <small id='yaPwH'></small><noframes id='yaPwH'>

            1. <tfoot id='yaPwH'></tfoot>
                <tbody id='yaPwH'></tbody>
            2. <legend id='yaPwH'><style id='yaPwH'><dir id='yaPwH'><q id='yaPwH'></q></dir></style></legend>

                  <bdo id='yaPwH'></bdo><ul id='yaPwH'></ul>
                  <i id='yaPwH'><tr id='yaPwH'><dt id='yaPwH'><q id='yaPwH'><span id='yaPwH'><b id='yaPwH'><form id='yaPwH'><ins id='yaPwH'></ins><ul id='yaPwH'></ul><sub id='yaPwH'></sub></form><legend id='yaPwH'></legend><bdo id='yaPwH'><pre id='yaPwH'><center id='yaPwH'></center></pre></bdo></b><th id='yaPwH'></th></span></q></dt></tr></i><div id='yaPwH'><tfoot id='yaPwH'></tfoot><dl id='yaPwH'><fieldset id='yaPwH'></fieldset></dl></div>

                  本文介绍了如何在经典 ASP 中返回 JSON 对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我想使用经典的 ASP 脚本返回一个 JSON 对象(它是 AJAX 请求的一部分).

                  I want to return a JSON object using a classic ASP script (it's part of an AJAX request).

                  如果我只是将回复发送为如下文本:

                  If I just send the reponse as text like:

                  response.write("{ query:'Li', suggestions:['Liberia','Libyan Arab Jamahiriya','Liechtenstein','Lithuania'], data:['LR','LY','LI','LT'] }")
                  

                  这会起作用吗,还是我真的需要一个 JSON 库?

                  will this work, or do I actually need a JSON library?

                  我正在尝试在 http://www.devbridge.com/projects/autocomplete/jquery/#howto 工作.

                  I'm trying to get the autocomplete plugin at http://www.devbridge.com/projects/autocomplete/jquery/#howto to work.

                  javascript:

                  javascript:

                   $(document).ready(function() {
                      var a = $('#txtValue').autocomplete({ 
                      serviceUrl:'script.asp',
                      minChars:2, 
                      maxHeight:400,
                      width:300,
                      zIndex: 9999,
                      deferRequestBy: 0, //miliseconds
                      onSelect: function(value, data){ alert('You selected: ' + value + ', ' + data); },
                  });
                  

                  平均售价:

                  <% 
                  response.ContentType = "application/json"
                  response.write("{ query:'Li', suggestions:['Liberia','Libyan Arab Jamahiriya','Liechtenstein','Lithuania'], data:['LR','LY','LI','LT'] }") 
                  %>
                  

                  自动完成功能不起作用.如果我使用像这样的本地查找数组,它会起作用查找:['一月','二月','三月','四月','五月']

                  Autocomplete is not working. It works if I use a local lookup array like lookup: ['January', 'February', 'March', 'April', 'May']

                  但是 ajax 有问题,这意味着它不能正确返回列表.

                  But there's something wrong with the ajax meaning it doesn't return the list properly.

                  推荐答案

                  好像是客户端解析错误.

                  It appears to be a parsing error on the client side.

                  我不认为这会有所作为,但看起来如果你引用所有内容,包括属性名称,它似乎可以工作.并使用双引号而不是单引号 - 这显然会有所作为.

                  I didn't think this would make a difference, but it looks like if you quote everything, including the property names, it seems to work. And use double-quotes instead of single quotes - that apparently is making a difference.

                  记得把你的双引号加倍(至少我认为你在 VBScript 中是这样做的——已经很久了).

                  Remember to double your double-quotes (at least I think that's how you do it in VBScript - been a long time).

                  所以:

                  <%
                      Response.ContentType = "application/json"
                      Response.Write("{ ""query"":""Li"", ""suggestions"":[""Liberia"",""Libyan Arab Jamahiriya"",""Liechtenstein"",""Lithuania""], ""data"":[""LR"",""LY"",""LI"",""LT""] }")
                  %>
                  

                  这篇关于如何在经典 ASP 中返回 JSON 对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:ASP Classic 使用什么版本的 JavaScript? 下一篇:使用 javascript substring() 创建阅读更多链接

                  相关文章

                  最新文章

                • <small id='bBo5C'></small><noframes id='bBo5C'>

                  <legend id='bBo5C'><style id='bBo5C'><dir id='bBo5C'><q id='bBo5C'></q></dir></style></legend>
                  1. <tfoot id='bBo5C'></tfoot>

                      <bdo id='bBo5C'></bdo><ul id='bBo5C'></ul>
                    <i id='bBo5C'><tr id='bBo5C'><dt id='bBo5C'><q id='bBo5C'><span id='bBo5C'><b id='bBo5C'><form id='bBo5C'><ins id='bBo5C'></ins><ul id='bBo5C'></ul><sub id='bBo5C'></sub></form><legend id='bBo5C'></legend><bdo id='bBo5C'><pre id='bBo5C'><center id='bBo5C'></center></pre></bdo></b><th id='bBo5C'></th></span></q></dt></tr></i><div id='bBo5C'><tfoot id='bBo5C'></tfoot><dl id='bBo5C'><fieldset id='bBo5C'></fieldset></dl></div>