Json JavaScript前端和Progress4GL后端

Json JavaScript前端和Progress4GL后端,json,progress-4gl,openedge,Json,Progress 4gl,Openedge,我想用前端HTML+JavaScript和后端Progress4GL创建一个应用程序 我找到了以下文档:(请参阅介绍AJAX和介绍JSON)。在所描述的示例中,请求数据时使用GET方法: xmlhttp.open("GET", "http://localhost/cgi-bin/cgiip.exe/WService=wsbroker1/getcustomersJSON_param.p?piCustNum="+ custval, true); xmlhttp.send();

我想用前端HTML+JavaScript和后端Progress4GL创建一个应用程序

我找到了以下文档:(请参阅介绍AJAX和介绍JSON)。在所描述的示例中,请求数据时使用GET方法:

xmlhttp.open("GET", "http://localhost/cgi-bin/cgiip.exe/WService=wsbroker1/getcustomersJSON_param.p?piCustNum="+ custval, true);            
xmlhttp.send();
在Progress4GL过程中,用于获取参数,它被使用
get value(“piCustNum”)

在我的应用程序中,我想使用POST方法。因此,请求将是,例如:

xmlhttp.open("POST","http://localhost/cgi-bin/cgiip.exe/WService=wsbroker1/getcustomersJSON_param.p",true);
xmlhttp.send("piCustNum=" + custval);
但我不知道如何在进程端获取发送的参数。实际上我想发送一个stringifyjson


有人能帮我吗?谢谢

如果要将JSON数据发布到webspeed程序,请签出;如果发布的数据超过32K,请签出WEB-CONTEXT:FORM-LONG-INPUT

现在。。。关于读取JSON数据,这取决于您的OpenEdge版本。InProgress开始支持JSON,但是它非常有限,特别是如果您无法控制JSON的创建方式。因为您是创建JSON数据的人,所以它可能适合您。版本11.1更好地支持JSON,包括SAX流实现


我们使用的是10.2版,所以我不得不使用将JSON转换为CSV文件。如果您可以在服务器上访问Python,那么就需要将前端转换为CSV文件,我建议您使用一些库(如)来处理ajax的请求,而不是处理使用不同浏览器等的复杂性。您可以使用jQuery的函数,如$.ajax、$.get或$.post来发出请求

向webspeed页面发布帖子可以很容易地做到以下几点:

var data = {
  tt_param: [ { id: 1, des: 'Description 1' } ]
}

var params = { data: JSON.stringify(data) }

$.post(
  'http://<domain>/scripts/cgiip.exe/WService=<service>/ajax.p',
  params,
  function (data) {
    alert('returned:' + data);
  },
  'text'
);
这是一个很好的起点,希望能有所帮助


干杯,

节点中有一个库,用于动态调用Progress业务逻辑。我希望这会有所帮助。

我有进步11.2。为了读取JSON,我使用readJSON方法:临时表ttTodo:readJSON(“LONGCHAR”,lcJSON)。
{src/web2/wrap-cgi.i}

def temp-table tt_param no-undo
    field id  as int
    field des as char.

def var lc_param as longchar no-undo.

procedure output-header:
    output-content-type("text/text").
end.

run output-header.

assign lc_param = get-value('data').

temp-table tt_param:read-json('longchar', lc_param).

find first tt_param no-error.

{&OUT} 'Cod: ' tt_param.id ', Des: ' tt_param.des.