Webdatarock export as HTML without download in React

94 Views Asked by At

I want to get the webdatarock table in HTML tag content without downloading in React JS. In JavaScript, below code works for me.

pivot.exportTo("html", { destinationType: "server", url: "" }, res =\> { console.log(res.data) })

In react, It shows error as shown in Image. enter image description here

let params = { destinationType: "server", url: "/", }; TableRef.webdatarocks.exportTo("html", params, (res) => { console.log(res); });

I have tried by specify direct path in URL but it shows cros-orgin error.. Not able to get html content

1

There are 1 best solutions below

4
On

The callback can't return the exported data, if the export is not successful. For your case, you could use any URL which would return you the success, for example:

let params = { destinationType: "server", url: "https://httpstat.us/200", };
TableRef.webdatarocks.exportTo("html", params, (res) => {
      console.log(res);
});