|
|
Rank: Member Groups: Member
Joined: 6/20/2006 Posts: 3 Points: 3
|
Environment: asp.net C# I have tried to write Response.Write("Error"); in the server side program (.cs) and catch the result by client side javascript (.aspx) as below. Code:
if (Status=="COMPLETE"){
if(StatusText == "Error"){
alert("Error occurs");
}
}
But it can't work, anybody help? The StatusText seems not equal to "Error".
|
|
 Rank: Advanced Member Groups: Administration
, Member
Joined: 7/28/2003 Posts: 1,254 Points: -345 Location: WA, US
|
JavaScript string equality operator (==) is case-sensitive. So you should use "ERROR" string of "Error" one. This code (syntax with iuembed.js) works for me: Code:
iu.addEventListener("Progress", "ImageUploader_Progress");
function ImageUploader_Progress(Status, Progress, ValueMax, Value, StatusText){
if (Status=="ERROR"){
alert(StatusText);
}
}
For testing I used following server-side code: Code:
Response.Write ("Hello")
Response.StatusCode = 500
P.S. It seems [code] forum tag is broken and admin should fix it. :(
Best regards, Fedor Skvortsov
|
|
Rank: Member Groups: Member
Joined: 6/20/2006 Posts: 3 Points: 3
|
Thank you for your reply. But still can't work for the following code on the client side: Code:
if (Status == "ERROR"){
alert(StatusText);
}
The StatusText displays a lot of the codes and seems can't terminate on the screen. Do I need to clear something first for the response action?
|
|
Rank: Member Groups: Member
Joined: 6/21/2006 Posts: 1 Points: 0
|
I'm not sure if I understand completely, but if you are trying to generate only the string "Error" as the response, maybe the following will help: Code:
Response.Clear();
Response.Write("Error");
Response.End();
|
|
|
Guest |