Albright
Albright

Reputation: 109

save XML file with jquery

I want to save XML file in "abbrxml.xml." I want to put the sentence like"'Hello world'" and then save XML. here is the code. when I try this, nothing happens. How can I save XML file with the sentence that I want to put in xml??

type: 'button',

                   id: 'btnFind',
                    align: 'left',
                    style: 'width:100%',
                    label: 'add',

                    onClick: function () {

                        $.ajax({
                            type: "get",
                            url: "abbrxml.xml",
                            dataType: "xml",
                            success: function (xml) {
                                $(xml).find('root').each(function () {
                                    var test = $(this).find("entry").text();
                                    var abbr = '<xml><message>Hello world</message></xml>';
                                    $("test").append(abbr);
                                });
                            }
                        });

Upvotes: 1

Views: 4308

Answers (1)

Simon M
Simon M

Reputation: 2941

Javascript can't write files on the server, as it's downloaded and run locally. You'll need to send your javascript-edited XML via AJAX to a PHP file which saves it for you, or something similar.

Upvotes: 2

Related Questions