Rank: Member
Groups: Member
Joined: 6/19/2006(UTC) Posts: 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". Edited by user Monday, February 18, 2008 4:28:13 PM(UTC)
| Reason: Not specified
|
|
|
|
Rank: Advanced Member
Groups: Member, Administration, Moderator Joined: 7/28/2003(UTC) Posts: 1,660
Thanks: 5 times Was thanked: 76 time(s) in 74 post(s)
|
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. :( Edited by user Monday, February 18, 2008 4:28:42 PM(UTC)
| Reason: Not specified |
Best regards, Fedor Skvortsov
|
|
|
|
Rank: Member
Groups: Member
Joined: 6/19/2006(UTC) Posts: 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? Edited by user Monday, February 18, 2008 4:28:57 PM(UTC)
| Reason: Not specified
|
|
|
|
Rank: Member
Groups: Member
Joined: 6/21/2006(UTC) Posts: 1
|
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();
Edited by user Monday, February 18, 2008 4:29:15 PM(UTC)
| Reason: Not specified
|
|
|
|
Rank: Newbie
Groups: Member
Joined: 3/31/2009(UTC) Posts: 1
|
Hi I am experiencing the same issue where by if the response from my processing page completes successfully then the Event Listener fires fine (i.e. "COMPLETE") but if the process page generates a 500 error it doesn't, (i.e. "ERROR") Code:
function ImageUploader_Progress(Status, Progress, ValueMax, Value, StatusText)
{
if (Status=="COMPLETE"){
alert(StatusText);
}
if (Status=="ERROR"){
alert(StatusText);
}
}
var iu = new ImageUploaderWriter("ImageUploader", 800, 600);
iu.addParam("Action", "PROCESS PAGE");
iu.addEventListener("AfterUpload", "ImageUploader_Progress");
Is this a known issue and is there any other way of checking whether the PROCESS PAGE has errored in any other way? Any help would be great Ta
|
|
|
|
Rank: Newbie
Groups: Member
Joined: 3/18/2009(UTC) Posts: 4
|
I ran into this over a year ago. So I created my own and its worked flawlessly. Sever-Side on uploading images: Create a try catch block and use string _errorScript = null; _errorScript = "<script type='text/javascript'>YOURJAVASCRIPTFUNCTION();</script> "; ClientScript.RegisterStartupScript(this.GetType(), "closeWin", _errorScript); Edited by user Tuesday, March 31, 2009 2:24:38 PM(UTC)
| Reason: Not specified
|
|
|
|
Rank: Advanced Member
Groups: Member
Joined: 3/9/2008(UTC) Posts: 554
Was thanked: 1 time(s) in 1 post(s)
|
Hello, I just tried to generate "500" server error using the following code: Code:Response.StatusCode = 500;
On client side I used your code sample: Code:function ImageUploader_Progress(Status, Progress, ValueMax, Value, StatusText)
{
if (Status=="COMPLETE"){
alert(Status);
alert(StatusText);
}
if (Status=="ERROR"){
alert(Status);
alert(StatusText);
}
}
In this case Image Uploader gets Status = "ERROR". I have reproduced this situation with Image Uploader 5.7.24. Try to use this version. |
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.