title: Javascript dataURL POST to PHP not working
body: <p>I'm trying to post dataURL over to php but with no succsess.
  My .js file is as follow.</p>
  
  <pre><code>var dataURL = signaturePad.toDataURL();
  alert(dataURL);
  $.ajax({ 
      type: "POST", 
      url: "test.php", 
      data: { 
      imgBase64: dataURL 
      } 
      }).done(function(o) { 
        console.log('saved');
        alert(o); 
      });
  </code></pre>
  
  <p>alert(dataURL) output is as follow;</p>
  
  <pre><code>data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAhkAAADZCAYAAACNbSIWAAAeW.....
  </code></pre>
  
  <p>test.php</p>
  
  <pre><code>&lt;?php
  if($_POST['imgBase64']) { 
  $img = $_POST['imgBase64'];
  }
  else{
  $img = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAhkAAADZCAYAAACNbSIWAAAeW.....";
  }
  $img = str_replace('data:image/png;base64,', '', $img);
  $img = str_replace(' ', '+', $img);
  $fileData = base64_decode($img);
  //saving
  $timestamp = date('YmdHis');
  $fileName = ''.$timestamp.'.png';
  echo"$fileData";
  file_put_contents($fileName, $fileData);
  ?&gt;
  </code></pre>
  
  <p>In my php file I have entered the value of my alert for testing purposes. Now my php page is working 100% due to the test and passing no value from my .js function. but with the correct value it's not even posting to my php page, only when I remove all not standard characters from the dataURL then it post but obvious with corrupt data.</p>
  
  <p>To avoid further confusion the following code works 100%, the .js and the php. where var dataURL = signaturePad.toDataURL(); is passed to the function</p>
  
  <pre><code>function postData(data) {
      alert(data);
      var desired = data.replace(/[^\w\s]/gi, '');
      $.ajax({ 
          type: "POST", 
          url: "test.php", 
          data: { 
          imgBase64: desired 
          } 
      }).done(function(o) { 
         console.log('saved');
         alert(o); 
      }); 
  }
  </code></pre>
  
  <p>So the problem is the .js will not post with the given dataUrl due to special characters, but I cant remove them.. I even tried var desired = encodeURIComponent(data); witch I can at least decode on the php page but this also does not want to post.</p>