Sending A Canvas.toDataUrl() To Php Via AJAX
I am trying to send a canvas.toDataUrl() to a php page via AJAX. Here's is my try: JavaScript code: function showUser() { str = 'url='+canvas.toDataUrl(); if (window.XMLHttpR
Solution 1:
SOLVED
The problem was that I was trying to send Large data through GET, I solved it by sending the same (large) data through POST POST is a little more complex than GET though
Here's how to send data via AJAX using POST:
http://www.javascriptkit.com/dhtmltutors/ajaxgetpost2.shtml
I used the code in the link and it works fine with me anyone having the same problem please refer the link above and use POST instead of GET
Thanks everybody
Solution 2:
I reccommend trying the javascript encodeURIComponent() function like this:
str = "url="+encodeURIComponent(canvas.toDataUrl());
The thing is, that dataurl contains symbols like "/" so it might get falsely interpreted. Let me know if that works.
Post a Comment for "Sending A Canvas.toDataUrl() To Php Via AJAX"