delphi programming forums mysql charset mget recursive synonimos
free ventrilo servers hosting cs javascript delay python find in list
Back Forum New
abstract:

// if login fails
alert(errorDetails); //Can I access the Coldfusion error details here?
} else {
document.getElementById('login_response').innerHTML = response;
}
}
}
Thanks


We are using Coldfusion MX7. I am calling a CFM file in AJAX function. I would like to know if there is a way to display the server-side error inside the AJAX function.
For example, the following is the function called after receiving response from the server (AJAX call).
function loginReply() {
if(http.readyState == 4){
var response = http.responseText;
if(response == 0){
// if login fails
alert(errorDetails); //Can I access the Coldfusion error details here?
} else {
document.getElementById('login_response').innerHTML = response;
}
}
}
Thanks

TOP

Yes, this is for development only and the server is setup to show errors.
What I need is, display the error in a new javascript window.
function cm_handleRegShutdownDays() {
  if(cm_xmlHttp.readyState == 4) {
    if(cm_xmlHttp.status == 200) {
      //success
      //some code
    }
    else {
       //error - display CF error page in a new window
       document.getElementById('myTempDiv').innerHTML = cm_xmlHttp.responseText; //displays error in a defined div
    }
  }
}
I would like to open a new window inside the 'else' condition and write 'responseText' to the new window and display to the user. Is it possible ?
Originally Posted by kiteless
If the server displays the error message then you should be able to see it in the response. However, this is a very bad idea since it exposes sensitive information, which is the whole reason you DON'T show error messages to users. If this is for development only, you should be able to see the error in the response if the server is set up to show errors. You can also catch the error yourself using cferror or onError() and display that. Basically anything that the server would normally display on an HTML page will be in the response.

TOP

First, I think you can benefit a lot from jQuery / ajax library.
Second, try this on your .cfm page that you call via ajax:
Code:
  1. <cftry>
  2. ...
  3. stuff
  4. ...
  5. <cfcatch type="any">
  6. <script>
  7. <cfoutput>
  8. alert('#jsStringFormat(cfcatch.message)#');
  9. </cfoutput>
  10. </script>
  11. </cfcatch>
  12. </cftry>
Copy Code
Hope it helps...



// if login fails
alert(errorDetails); //Can I access the Coldfusion error details here?
} else {
document.getElementById('login_response').innerHTML = response;
}
}
}
Thanks

TOP

Back Forum