使用Prototype发布复杂的JSON对象

Chr*_*ris 1 javascript python iis prototypejs

我正在使用Prototype 1.6.1在IIS下使用ASP和Python创建一个应用程序.

python正在生成一个复杂的JSON对象.我想通过AJAX请求将此对象传递给另一个页面,但Prototype文档对我来说有点过于狡猾.

有人可以给我看一个如何创建一个Prototype AJAX.Request的例子来POST一个JSON对象,然后打印出"Ok,I got it"或类似的东西?

维伦沉没!

Nos*_*ama 7

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...') }
});
Run Code Online (Sandbox Code Playgroud)