Prototype,ajax and request.responseText

I make an ajax request with prototype with a popup and if the return request.responseText is ‘success’ I want to close this popup so I write this code that does not work.what is wrong?

function undoRequestCompleted(request)
{ if (eval(trim(request.responseText)).toString()=="success");
 // alert(request.responseText)

Why not setup you page to send the right status codes and just use Prototype’s success and failure handlers?

new Ajax.Request('/your/url', {
  onSuccess: function(xhr) {
    // doSomething
  onFailure: function(xhr) {
    // doSomething

Much nicer :slight_smile: