Skip to content

Instantly share code, notes, and snippets.

@hellt hellt/pycatjify.js

Last active Jul 29, 2019
What would you like to do?
javascript portion of the pycatjify web service
$(function () {
$('#convert_btn').click(function () {
var data = {} // object to hold the user input data
// store user data in a data["pycatj_data"]
if ($('#yaml_switch').prop("checked")) {
data["pycatj_data"] = $('#in_form').val() // in case of YAML data - store it as a string
} else {
data["pycatj_data"] = JSON.parse($('#in_form').val()) // in case of JSON data - store it as an object
// todo: add root input element
// data["root"] = "POST"
var body = JSON.stringify(data)
url: "",
contentType: "application/json",
data: body,
dataType: "json",
type: 'POST',
success: function (response) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.