Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Editing an XML file with JavaScript?

Tags:

javascript

xml

Is it possible to get an XML file (not HTML) from a server, add/remove/edit particular parts of it with client-side JavaScript, and then send it back to the server to save it? JSON or any other markup/data interchange format works too.

like image 915
Skofo Avatar asked Feb 17 '26 05:02

Skofo


1 Answers

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");
});
like image 136
Josh Stodola Avatar answered Feb 18 '26 18:02

Josh Stodola



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!