Попытка отправить данные из SVG в виде почтового запроса.JavaScript - PullRequest
0 голосов
/ 27 июня 2019

У меня есть этот скрипт. Он собирает данные точек полилинии из SVG. Он выводит данные на консоль. Я пытаюсь отправить эти данные в виде почтового запроса.

Я уже пытался добавить переменную в запрос, как вы можете видеть на w: (polylines.strokeWidth)

var $ = unsafeWindow.jQuery;
var jQuery = unsafeWindow.jQuery;
// Create request to fetch the SVG file.
xhr=new XMLHttpRequest();
// Tell the request where the file is.
xhr.open("GET", "http://colorillo.com/bxys.inline.svg");
// Add event handler to process the file once it's been fetched.
xhr.addEventListener("load", function() {
// Once the text is available, create an XML parser
// and parse the text as an SVG image.
const xmlDoc = new DOMParser().parseFromString(
this.responseText.trim(),
"image/svg+xml"
 );
// xmlDoc.getElements() returns something Array-like, but not an Array.
// This turns it into an Array.
const polylines = Array.from(xmlDoc.getElementsByTagName('polyline'));
console.log(polylines.map(
pl => [
  // Parses each 'points' attribute into an array of pairs of numbers
  pl.getAttribute('points').split('').map(
    pair => pair.split(',').map(x=>+x)
  ),
  // Various stroke information
  pl.style.stroke,
  +pl.style.strokeWidth,
]
));
       $.post("http://colorillo.com/draw.php?ing=_index", {
                l: (polylines.map),
                w: (polylines.strokeWidth),
                c: ("#00ff00"),
                o: ("100"),
                f: ("1"),
                _: ("false")
            })
});
xhr.send();

Этот код выше выдает ошибку в консоли Google. Я понятия не имею, как это сделать. Я просто хочу получить данные о полилиниях и strokeWidth и отправить их в виде почтового запроса.

...