Send signature thru Ajax

I want to send the signature from mobile to web MYSQL. I can capture the signature and convert to base64 string and store within SQLITE. I try to send to the web MYSQL thru Ajax, but it fail everytime.

What message do you get when you try to send it through Ajax? It’s just a string - it should be fine.

I found the problem may be the imageStr is too long for Ajax. When I am using the signature size of 150 X 75, it work fine. But when I am using 300 X 150, it always fail. Is there any string length limit for Ajax?

I have been using ajax to send images to my database. This is an example, I pass this value as a parameter:


I do not recall well, but in IIS you have to increase the requesting limit. Google it and you will find it.

Do you mean using encodeURIComponent(upPictureBox.toDataURL(“image/png”)) instead of upPictureBox.toDataURL(“image/png”)?

It is what it worked for me. Beside the limit requesting limit increase.

300 x150 x 8 bits (b&w i assume) is only 45K. Even in 24 bit color, it’s only 150k uncompressed. I doubt it is on the client side, most likely server, You’ll want to review the server logs if the size is not the issue. IIS used to have a 32k limit default, so size makes sense if you’re using IIS, We moved to hosted services years ago mainly to avoid IIS maintenance issues.

Thanks Gary.
I am using the GET in the first place, so it fail sometime. Now I changed to use POST and everything fine.

That makes sense. GET is really for getting data. Usually a GET has a Query string at the end of the URL. The entire GET is sent as clear text. I don’t think you want that for a signature. POST on HTTPS over AJAX will automatically encrypt the body of the message. I’m assuming you are using an HTTPS host, as CORS/CSP issues would arise if not. Good luck.

GET has limits on it. POST lets you send a lot more.