Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Chiamata ajax
- function reqImg( request, user, password, index, callback){
- var url = "URL_IMAGE_API";
- var params = "request=" + request +"&user=" + user +"&password=" + password +"&carriera=" + carriera;
- var http = new XMLHttpRequest();
- http.open("POST", url, true);
- //Send the proper header information along with the request
- http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
- http.onreadystatechange = function() {//Call a function when the state changes.
- if(http.readyState == 4 && http.status == 200) {
- callback(http.response);
- }
- }
- http.send(params);
- }
- ////// QUI LO SNIPPET CHE USO PER PRINTARLA
- reqImg("imgProfilo", "user", "pass", "0", function( response ) {
- //$('#imgProfilo').append(response); // non funziona
- $('#imgProfilo').append('<img src="data:image/png;base64,' + response + '" />');
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement