Forum Moderators: open
Response.ContentType = "text/plain"
Response.Write("E,An error occurred while trying to save your results.\nYour results have not been recorded for this test.\n\nDescription: " & strDescription & "\nError Number: " & strNumber & "\nSource: " & Request.ServerVariables("SCRIPT_NAME"))
Response.End()
And on my page I have the following:
if ( x.substr(0,1) == "E") {
window.alert( x.substr(2) );
}
I get my message in my alert box but it doesn't recognize the \n instead they show up in the alert box.
How do I get it to recognize the \n?
try
type="text/javascript"
although I suspect that javascript might not recognise the & symbol
and the double-quotes can be a source of bugs
maybe the following will work
Response.Write('E, An error occurred while trying to save your results.\nYour results have not been recorded for this test.\n\nDescription: ' + strDescription + '\nError Number: ' + strNumber + '\nSource: ' + Request.ServerVariables('SCRIPT_NAME'))
ASP:
Response.Write("x = ""E,An error occurred while trying to save your results.\nYour results have not been recorded for this test.\n\nDescription: " & strDescription & "\nError Number: " & strNumber & "\nSource: " & Request.ServerVariables("SCRIPT_NAME") & """;")
Javascript:
eval(responseText);
if ( x.substr(0,1) == "E") window.alert(x.substr(2));
I was testing with an ajax call which I am assuming is similar to what you were doing.