Click here to Skip to main content
15,891,951 members
Home / Discussions / JavaScript
   

JavaScript

 
GeneralRe: Google Chart error Pin
miss7867-Mar-14 3:52
miss7867-Mar-14 3:52 
Questiondatetime can't be change other format? Pin
pkarthionline17-Feb-14 2:11
pkarthionline17-Feb-14 2:11 
SuggestionRe: datetime can't be change other format? Pin
Richard MacCutchan17-Feb-14 2:43
mveRichard MacCutchan17-Feb-14 2:43 
Questionabout window app Pin
Member 1057338416-Feb-14 0:50
Member 1057338416-Feb-14 0:50 
AnswerRe: about window app Pin
Richard MacCutchan16-Feb-14 1:20
mveRichard MacCutchan16-Feb-14 1:20 
QuestionWant to add radio button and append the value in CSV file Pin
abmanish7115-Feb-14 19:10
abmanish7115-Feb-14 19:10 
AnswerRe: Want to add radio button and append the value in CSV file Pin
Kornfeld Eliyahu Peter15-Feb-14 20:33
professionalKornfeld Eliyahu Peter15-Feb-14 20:33 
Questionretrieve and display image from SQL server in html Pin
Member 1057920214-Feb-14 11:18
Member 1057920214-Feb-14 11:18 
Hi I would like to retrieve and image from SQL table (blob) and display that image in html web page. I have create a handler to retrieve the image but am stuck on how to get into javascript. Any ideas?

here my handler...
Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
        Dim ds As New DataSet()
        Dim al As New ArrayList()
        Using con As New SqlConnection(GetConnectionString("myconnection"))
            Using cmd As New SqlCommand()
                cmd.CommandType = CommandType.StoredProcedure
                cmd.CommandText = "spRFIDocumentByRequestIDSelect"
                cmd.Parameters.AddWithValue("@pRequestID", 531)
                cmd.Connection = con
                con.Open()
                Dim sdr As SqlDataReader = cmd.ExecuteReader()
                If sdr.HasRows Then
                    While sdr.Read()
                        al.Add(sdr(0).ToString())
                        al.Add(sdr(1).ToString())
                        al.Add(sdr(2).ToString())
                        context.Response.ContentType = "image/jpeg"
                        context.Response.Write(sdr(2))
                    End While
                Else
                    al.Add("No Results")
                End If
                con.Close()
            End Using
        End Using
    End Sub


and here is html and javascript...
XML
<div id="fileDisplayArea"></div>
<script type="text/javascript">
    $(document).ready(function () {
        var xhr = new XMLHttpRequest();
        xhr.open('GET', 'GetImageHandler.ashx', true);
        xhr.responseType = 'blob';

        xhr.onload = function (e) {
            if (this.status == 200) {
                var blob = new Blob([this.response], { type: 'image/jpeg' });
                var reader = new FileReader();
                reader.onload = function (e) {
                    var thumbnail = reader.result;
                    fileDisplayArea.innerHTML = "";
                    var img = new Image();
                    img.src = reader.result;
                    alert(img.src);
                    fileDisplayArea.appendChild(img);
                }
                reader.readAsDataURL(blob);
            }
        };

        xhr.send();
</script>

JavaScript


AnswerRe: retrieve and display image from SQL server in html Pin
Richard Deeming17-Feb-14 2:04
mveRichard Deeming17-Feb-14 2:04 
GeneralRe: retrieve and display image from SQL server in html Pin
Member 1057920218-Feb-14 7:46
Member 1057920218-Feb-14 7:46 
GeneralRe: retrieve and display image from SQL server in html Pin
Richard Deeming18-Feb-14 8:04
mveRichard Deeming18-Feb-14 8:04 
GeneralRe: retrieve and display image from SQL server in html Pin
Member 1057920218-Feb-14 8:09
Member 1057920218-Feb-14 8:09 
GeneralRe: retrieve and display image from SQL server in html Pin
Richard Deeming18-Feb-14 8:14
mveRichard Deeming18-Feb-14 8:14 
GeneralRe: retrieve and display image from SQL server in html Pin
Member 1057920218-Feb-14 8:41
Member 1057920218-Feb-14 8:41 
GeneralRe: retrieve and display image from SQL server in html Pin
Richard Deeming18-Feb-14 8:59
mveRichard Deeming18-Feb-14 8:59 
GeneralRe: retrieve and display image from SQL server in html Pin
Member 1057920218-Feb-14 9:04
Member 1057920218-Feb-14 9:04 
QuestionHow to set color in whole project Pin
Member 1059282712-Feb-14 20:01
Member 1059282712-Feb-14 20:01 
AnswerRe: How to set color in whole project Pin
Richard Deeming13-Feb-14 1:26
mveRichard Deeming13-Feb-14 1:26 
QuestionAdblock system Pin
Member 804117812-Feb-14 18:23
Member 804117812-Feb-14 18:23 
AnswerRe: Adblock system Pin
Richard MacCutchan12-Feb-14 21:46
mveRichard MacCutchan12-Feb-14 21:46 
AnswerRe: Adblock system Pin
Sibeesh KV29-Sep-14 2:02
professionalSibeesh KV29-Sep-14 2:02 
Questioncopy items of one dropdownlist to another one with jquery Pin
H.Goli11-Feb-14 6:38
H.Goli11-Feb-14 6:38 
AnswerRe: copy items of one dropdownlist to another one with jquery Pin
Kornfeld Eliyahu Peter11-Feb-14 6:54
professionalKornfeld Eliyahu Peter11-Feb-14 6:54 
QuestionCreating a static Map Pin
mrkeivan7-Feb-14 19:34
mrkeivan7-Feb-14 19:34 
GeneralRe: Creating a static Map Pin
Sunasara Imdadhusen21-May-14 23:43
professionalSunasara Imdadhusen21-May-14 23:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.