Hey guys, I'm just learning JavaScript, and I have a question that I hope someone can answer. Is it possible to get an XML file (not HTML) from the server, add / remove / edit individual parts of it using client-side JavaScript, and then send it back to the server to save it? JSON or any other markup / data exchange format also works.
Yes. Using jQuery ...
$.get("myGetUrl.php", function(data) { var xml = $(data); xml.find("myNode").text("newValue"); $.post("myPostUrl.php", xml, function(resp) { alert(resp); }, "xml"); });
Yes it is possible. See the XML DOM section and you can easily edit it on the client.
. XML- AJAX DOM, HTML. jQuery, .
. XMLHttpRequest, , , , XMLHttpRequest. XML ( , , ), , , JSON .
script (.. PHP, ASP, Ruby) , (.. JSON XML-) , .
, , , .
. XMLHttpRequest XML-, , MIME text/xml. responseText XML, XML DOM responseXML. DOM , .
XMLHttpRequest
responseText
responseXML
JSON . XMLHttpRequest , jsonData = eval(xhr.responseText), JSON JavaScript.
jsonData = eval(xhr.responseText)
JavaScript /, . XML JSON Ajax.
Source: https://habr.com/ru/post/1710845/More articles:How do you write tr: nth-child (odd) in Sass? - ruby-on-railsIE7: How to make TD float? - cssRemoving svn checkout with NAnt - svnProblem with Url.Content in ASP.NET MVC - asp.netWhy does UPPER () not work in MySQL? - mysqlC # Bubbling / Walkthrough - c #How to make a flash movie to play full screen using javascript? - javascriptHow to set table column width for dynamic drop down list? - cssWhen do you need to delete an object? - c ++Minimize abbreviations in NSIS - installerAll Articles