views:

86

answers:

1

I'm using Prototype 1.6.1 to create an application under IIS, using ASP and Python.

The python is generating a complex JSON object. I want to pass this object to another page via an AJAX request, but the Prototype documentation is a little too cunning for me.

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?

Vielen dank!

+3  A: 
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...') }
});
Nosrama