jQuery AJAX写入XML

I'd like to write to an XML file using jQuery. Assume the following:

app.writeXML = function(data) {
    $.get("xml/sample.xml", function(resp) {
        var node = $(resp).find("Sample")
        $(node).append('<test>this is a test</test>')

        //write to the sample.xml file with the additional "test" node added

    }, 'xml')
} 

Is the new node "test" appended to the end of my "Sample" node in local memory, or do I have an error here?

If it is in local memory only, I assume I need a server-side component to actually write to the file. What would this look like using PHP?

Everything you do on client side

  1. get xml
  2. build dom for it
  3. add the node to the dom
  4. And then nothing, it is all in browser

You actually have to implement some api on server side for changing the file. For example you may have a php file in which you work with the xml file and on client side just do post request to it.

I dont think you can do it this way. What you might need to do is to have a post call in your jquery to post send the change and then have that update your xml.