You must be logged in to post your query.
Home › Forums › Chart Support › base64
Tagged: base64
i encoded the chart into base64 url and assigned that into js var variable,now i want to pass that value into php variable ,how do i do that
@senith,
You can pass the value of variables from JavaScript to PHP code using mechanisms such as GET or POST methods. Please refer this article for more information.
__________ Indranil Deo Team CanvasJS
What i do is:
Create a Form with POST Method and a text area inside with style=”display:none;” to hidde it.
<form action="/GetBase64Chart/" method="post" name="formToSendBase64" id="formToSendBase64"> <textarea style="display:none;" id="txtareaBase64" name="txtareaBase64"> </textarea> </form>
and with JS i create a button to “Export” the Base64 to the backend. Then i get the base64 of the canvas chart and i passed it to the textarea value like in the next code…
$("#exportButton").click(function () { var canvas = $("#Chart .canvasjs-chart-canvas").get(0); var dataURL = canvas.toDataURL(); document.getElementById("txtareaBase64").value = dataURL; var form = document.getElementById("formToSendBase64"); form.submit(); });
You must be logged in to reply to this topic. Login/Register