Currently, I am working on integrating Facebook with a website and I encountered a specific call in the Facebook API that posts a picture to a user's account. One of the parameters required is the raw image data. The image is stored locally on the web server and I have a URL for it. Initially, I tried to load the image on the client side using JavaScript, but I learned that it's not possible. So, I am now attempting to make an httpxml call to the server with the image URL in order to retrieve the image data. The code example I have works with a URL to a CSV file, but I am facing issues when trying to read the contents of the image files. When I try to access xmlhttp.responseText, I encounter an error. The API call I am trying to use this image data for is:
function getFile(pURL,pFunc) {
xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');
if (xmlhttp) {
eval('xmlhttp.onreadystatechange='+pFunc+';');
xmlhttp.open('GET', pURL, false);
xmlhttp.send();
}
}
function makeList() {
if (xmlhttp.readyState==4) {
if (xmlhttp.status==200) {
var tmpArr=xmlhttp.responseText;
document.getElementById('theExample').innerHTML=tmpArr;
}
}
}
I apologize for my lack of understanding in these web technologies. I am eager to learn, but I need to complete this task quickly before delving into the intricacies of web development. I have been entrenched in the world of C#/C++ for quite some time.