简体   繁体   English

使用原型发布复杂的JSON对象

[英]POSTing a complex JSON object using Prototype

I'm using Prototype 1.6.1 to create an application under IIS, using ASP and Python. 我正在使用Prototype 1.6.1在IIS下使用ASP和Python创建应用程序。

The python is generating a complex JSON object. python正在生成一个复杂的JSON对象。 I want to pass this object to another page via an AJAX request, but the Prototype documentation is a little too cunning for me. 我想通过AJAX请求将此对象传递给另一个页面,但是Prototype文档对我来说有点太狡猾了。

Can someone show me an example of how to create an Prototype AJAX.Request that POSTs a JSON object, and then just prints out "Ok, I got it" or something like that? 有人可以向我展示如何创建一个原型AJAX.Request的示例,该原型发布一个JSON对象,然后仅打印出“好,我明白了”之类的信息?

Vielen dank! Vielen潮湿!

new Ajax.Request('/some_url',
{
 method:"post",
 postBody:"{'some':'json'}",
 onSuccess: function(transport){
   var response = transport.responseText || "no response text";
   alert("Success! \n\n" + response);
   },
 onFailure: function(){ alert('Something went wrong...') }
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM