Wednesday, March 21, 2012

Passing a javascript array to a handler .ashx

I am using a handler (processImage.ashx) to display an image. The image is
displayed according to parameters passed in the querystring. The handerl is
called via some clientside javascript.

I want to send an array of unknown length to the handler. I am not sure
whether the querystring is the best place to do this. What's the best way to
send an array held in the client side javascript to the handler?

Thanks in advance,
JJyou can not post an image request, so the url is the only option other than a
prelimary ajax call. the url is restricted to about 2k. how you encode the
array depends on the array type. the most common is a array.join('|'), with a
matching split on the server side.

-- bruce (sqlwork.com)

"JJ" wrote:

Quote:

Originally Posted by

I am using a handler (processImage.ashx) to display an image. The image is
displayed according to parameters passed in the querystring. The handerl is
called via some clientside javascript.
>
I want to send an array of unknown length to the handler. I am not sure
whether the querystring is the best place to do this. What's the best way to
send an array held in the client side javascript to the handler?
>
Thanks in advance,
JJ
>
>
>


How would I do the prelimary ajax call?

Thanks,
JJ
"bruce barker (sqlwork.com)"
<brucebarkersqlworkcom@.discussions.microsoft.comwro te in message
news:C8495134-FF6B-4D8B-82C1-FE5F393D6454@.microsoft.com...

Quote:

Originally Posted by

you can not post an image request, so the url is the only option other
than a
prelimary ajax call. the url is restricted to about 2k. how you encode the
array depends on the array type. the most common is a array.join('|'),
with a
matching split on the server side.
>
-- bruce (sqlwork.com)
>
>
"JJ" wrote:
>

Quote:

Originally Posted by

>I am using a handler (processImage.ashx) to display an image. The image
>is
>displayed according to parameters passed in the querystring. The handerl
>is
>called via some clientside javascript.
>>
>I want to send an array of unknown length to the handler. I am not sure
>whether the querystring is the best place to do this. What's the best way
>to
>send an array held in the client side javascript to the handler?
>>
>Thanks in advance,
>JJ
>>
>>
>>


Hi JJ,

I think Bruce means you should pass the image urls(or any array parameters)
either through url querystring or through AJAX xmlhttp request. Directly
manipulate binary content of image is not quite supported in client script
and also not effecient to pass such large content frequently.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

This posting is provided "AS IS" with no warranties, and confers no rights.

-------

Quote:

Originally Posted by

>From: "JJ" <abc@.xyz.com>
>Subject: Re: Passing a javascript array to a handler .ashx
>Date: Tue, 20 Nov 2007 10:55:18 -0000


Quote:

Originally Posted by

>How would I do the prelimary ajax call?
>
>Thanks,
>JJ
>"bruce barker (sqlwork.com)"
><brucebarkersqlworkcom@.discussions.microsoft.comwro te in message
>news:C8495134-FF6B-4D8B-82C1-FE5F393D6454@.microsoft.com...

Quote:

Originally Posted by

>you can not post an image request, so the url is the only option other
>than a
>prelimary ajax call. the url is restricted to about 2k. how you encode


the

Quote:

Originally Posted by

Quote:

Originally Posted by

>array depends on the array type. the most common is a array.join('|'),
>with a
>matching split on the server side.
>>
>-- bruce (sqlwork.com)
>>
>>
>"JJ" wrote:
>>

Quote:

Originally Posted by

>>I am using a handler (processImage.ashx) to display an image. The image
>>is
>>displayed according to parameters passed in the querystring. The


handerl

Quote:

Originally Posted by

Quote:

Originally Posted by

Quote:

Originally Posted by

>>is
>>called via some clientside javascript.
>>>
>>I want to send an array of unknown length to the handler. I am not sure
>>whether the querystring is the best place to do this. What's the best


way

Quote:

Originally Posted by

Quote:

Originally Posted by

Quote:

Originally Posted by

>>to
>>send an array held in the client side javascript to the handler?
>>>
>>Thanks in advance,
>>JJ
>>>
>>>
>>>


>
>
>

0 comments:

Post a Comment