Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HTML
<script>

        $(document).ready(function () {

            $('#btnLogin').click(function () {

              

                $.ajax({
                    url: 'testurl',
                    type: 'Get',
                    beforeSend: function (xhr) {
                        xhr.setRequestHeader("Authorization", "Basic " + btoa("username" + ":" + "Password"));
                    },                    
                    success: function (response) {
                        
                        console.log(response)
            $('#imga').html('<img src="data:image/gif;base64,' + response + '" />');


                    },
                    error: function (error) {
                        alert("error")
                        console.log(error)
                    }
                });

            });
        });
    </script>



HTML
<input type="button" id="btnLogin" value="Login" />

   <div id="imga"></div>




��~e��m0R�a���l�����{ ��wV�7ہ�}��h��p�I������ahq ��cؽ�X �XV�c�x"r���+�d��p"�ҙ���cZ�E|*��U6�D��ߛ�)�$~ �jSD� �*xe���M�A�#
1) I am retrieve this type of data can i know what is this ?
2) how to convert this data to base64 using Jquery ?
Posted
Comments
Krunal Rohit 2-Dec-15 7:20am    
You using C# on server-side ?

-KR
bharatmsp 2-Dec-15 7:23am    
I am using jquery
Krunal Rohit 2-Dec-15 7:24am    
jQuery works on client-side, so I'll ask you again, what technology are you using to generate the response on server-side ?

-KR
bharatmsp 2-Dec-15 7:28am    
I do not know its third pary api I am using its developed by other person
Krunal Rohit 2-Dec-15 8:16am    
You code doesn't look like "a third party solution".

-KR

1 solution

Your going to have to ask whoever wrote the third party API what the crap is and how to decode it because it's not JSON and it's not Base64 encoded.

You would only encode something in Base64 to send to a server that expects data in that encoding. Your code isn't sending anything to the server at all so there's nothing to encode.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900