-1

I make an XMLHttpRequest and receive a response that looks like this

\u003Cdiv class=\u0027upcoming-events\u0027\u003E\r\n \u003Ch3 class=\u0027h3-med\u0027\u003E\u003Ca href=\u0022/user-calendar\u0022\u003ECalendar\u003C/a\u003EUpcoming\u003C/h3\u003E\r\n

What is this response type and how would I convert it to HTML in Javascript?

ecg8
  • 1,362
  • 1
  • 12
  • 16
cobysh
  • 45
  • 4

1 Answers1

0

You shouldn't have to perform any conversion; these Unicode characters should be interpreted correctly as-is.

var string = "\u003Cdiv class=\u0027upcoming-events\u0027\u003E\r\n \u003Ch3 class=\u0027h3-med\u0027\u003E\u003Ca href=\u0022/user-calendar\u0022\u003ECalendar\u003C/a\u003EUpcoming\u003C/h3\u003E\r\n";
document.body.innerHTML = string;
<body>
</body>
esqew
  • 42,425
  • 27
  • 92
  • 132