Программирование на jquery
-
Anonymous
JSON в XML преобразование в браузере с использованием jQuery
Сообщение
Anonymous »
Я пытаюсь преобразовать XML в JSON и JSON в XML. Мой XML -JSON успешно выполнен, но я не получаю JSON в XML в браузере. < /p>
Я проверил свое приложение REST в почте, где оно показывает правильно, но я не получаю результат в браузере. < /p>
Код: Выделить всё
$(document).ready(function() {
$("#xmltoJson").click(function() {
var req123 = $("#requesttext").val();
$.ajax({
type: "POST",
url: "http://localhost:8080/BookStore/rest/book/xmltoJson",
data: req123,
contentType: "application/xml"
}).done(function(msg) {
alert(msg)
$("#responsebox").html(JSON.stringify(msg));
});
});
$("#jsontoXml").click(function() {
var req123 = $("#requesttext").val();
$.ajax({
type: "POST",
url: "http://localhost:8080/BookStore/rest/book/JsontoXml",
data: req123,
contentType: "application/json"
}).done(function(msg) {
alert(msg)
$("#responsebox").append(msg).html();
});
});
});
XML To JSON Converter
XML
JSON
h1 {
color: green;
text-align: center;
}
.toptable {
width: 80%;
margin: auto;
height: 500px;
}
#requestbox {
width: 50%;
color: blue;
}
#responsebox {
width: 50%;
color: blue;
}
#requesttext {
width: 100%;
color: blue;
}
#submitbutton {
width: 100%;
}
Подробнее здесь:
https://stackoverflow.com/questions/414 ... ing-jquery
1739978268
Anonymous
Я пытаюсь преобразовать XML в JSON и JSON в XML. Мой XML -JSON успешно выполнен, но я не получаю JSON в XML в браузере. < /p>
Я проверил свое приложение REST в почте, где оно показывает правильно, но я не получаю результат в браузере. < /p>
[code]
$(document).ready(function() {
$("#xmltoJson").click(function() {
var req123 = $("#requesttext").val();
$.ajax({
type: "POST",
url: "http://localhost:8080/BookStore/rest/book/xmltoJson",
data: req123,
contentType: "application/xml"
}).done(function(msg) {
alert(msg)
$("#responsebox").html(JSON.stringify(msg));
});
});
$("#jsontoXml").click(function() {
var req123 = $("#requesttext").val();
$.ajax({
type: "POST",
url: "http://localhost:8080/BookStore/rest/book/JsontoXml",
data: req123,
contentType: "application/json"
}).done(function(msg) {
alert(msg)
$("#responsebox").append(msg).html();
});
});
});
XML To JSON Converter
XML
JSON
h1 {
color: green;
text-align: center;
}
.toptable {
width: 80%;
margin: auto;
height: 500px;
}
#requestbox {
width: 50%;
color: blue;
}
#responsebox {
width: 50%;
color: blue;
}
#requesttext {
width: 100%;
color: blue;
}
#submitbutton {
width: 100%;
}
[/code]
Подробнее здесь: [url]https://stackoverflow.com/questions/41443928/json-to-xml-conversion-in-the-browser-using-jquery[/url]