title: Sending photo from javascript to server
body: <p>Guys i am new to programming and i am really not aware of how to save a photo which is displayed in a div to server. I am working with java application and i am trying to display an image on div and then later save it on the server. As i know javascript variables cannot be declared in jsp or servlets because of client and server compatibility. I am trying to pass the url through ajax but its not getting displayed on the server because of base64 long string. I think we cannot pass such long string to jsp or servlet pages. Is there any alternate way i can pass the string or save image to the server?</p>
  
  <pre><code>function GetXmlHttpObject() {
  var xmlHttp=null;
  try {
   // Firefox, Opera 8.0+, Safari
   xmlHttp=new XMLHttpRequest();
   }
  catch (e) {
   //Internet Explorer
   try {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
   catch (e) {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
   }
  return xmlHttp;
  }
  
  function ajax() {   
  
  xmlHttp=GetXmlHttpObject(); 
  var url="/ServletExten/XmlServletGen";
  url=url+"?datax=" +cordXSend +"&amp;datay=" +cordYSend +"&amp;sizew=" +canvasWidth +"&amp;sizeh=" +canvasHeight ;
  alert(url); 
  xmlHttp.open("POST",url,true);
  xmlHttp.send(null);
  }
  </code></pre>