DocumentUp icon indicating copy to clipboard operation
DocumentUp copied to clipboard

jQuery example doesn't work

Open resynth1943 opened this issue 5 years ago • 6 comments

$.ajax({
  url: "https://documentup.com/compiled",
  dataType: "jsonp",
  data: {
    content: "# test",
    name: "Test JSONP!"
  },
  success: function(resp){
    // `status` is always provided
    if (resp.status == 200) {
      // Write to your document
      document.open();
      document.write(resp.html);
      document.close();
    }
  }
});

This actually generates a 404, for some odd reason. Not sure why, as this is a documented API in the README.

resynth1943 avatar Jul 01 '20 19:07 resynth1943

This was actually discovered when I was trying to replace this example with something that uses the native fetch.

resynth1943 avatar Jul 01 '20 20:07 resynth1943

Huh, good catch.

This is deprecated. Should remove from the docs.

jeromegn avatar Jul 02 '20 12:07 jeromegn

Deprecated? Fancy an MR that takes it out, then?

resynth1943 avatar Jul 02 '20 13:07 resynth1943

Either that or we re-implement it :) I think it's maybe a helpful feature, but not in that form exactly.

jeromegn avatar Jul 02 '20 13:07 jeromegn

Haha, I'd love to modernise some of this with fetch and the new cool JS APIs :D

resynth1943 avatar Jul 02 '20 14:07 resynth1943