I'm working with inline SVG. I need to send the SVG content to a server (running ASP.NET MVC) with other informations from the page. The code below works fine when the SVG content is small, but when the content is too big, the data is not being sent, it's not even sent to the Controller.
Javascript:
function saveSVG() {
var rack = document.getElementsByClassName("cwRacksSvgImg");
var markupTOs = '';
var script = associados.slice();
for (var i = 0; i < rack.length; i++) {
markupTOs = markupTOs + (new XMLSerializer()).serializeToString(rack[i]);
}
var svg = document.getElementsByTagName('svg')[0];
var floor_id = document.getElementById('floor_id').value;
var markup = (new XMLSerializer()).serializeToString(svg);
$.ajax({
type: 'Post',
dataType: 'json',
url: '/Planta/SavePlanta/',
data: JSON.stringify({
markup: markup,
markupTOs: markupTOs,
floor_id: floor_id,
script: script
}),
contentType: 'application/json; charset=utf-8',
success: function (data) {
}
});
}
Controller
public ActionResult SavePlanta(string markup, string markupTOs, int floor_id, string[] script) {
var bytes = Encoding.UTF8.GetBytes(markup);
}
Any suggestions to a similar approach that can deal with large SVG data?
Thank you in advance for your help!