使用jQuery显示ashx图像?

Abe*_*ler 6 asp.net jquery colorbox

我一直在尝试使用jQuery插件Colorbox通过ashx文件显示我在数据库中的图像.不幸的是,它只是在页面顶部吐出一堆胡言乱语而没有图像.可以这样做吗?这是我到目前为止:

   $(document).ready
   (
       function () 
       {
           $("a[rel='cbImg']").colorbox(); 
       }
   );
...
<a rel="cbImg" href="HuntImage.ashx?id=15">Click to see image</a>
Run Code Online (Sandbox Code Playgroud)

更新:

我的ashx文件正在编写二进制文件:

            context.Response.ContentType = "image/bmp";
            context.Response.BinaryWrite(ba);
Run Code Online (Sandbox Code Playgroud)

Jam*_*uth 10

Colorbox有一个选项'照片'.如果在构造函数中将此属性设置为true,则会强制它渲染照片.

$(target).colorbox({photo: true});
Run Code Online (Sandbox Code Playgroud)