Writing to XML file using jQuery
<p>Is there any way to write to a xml file using jQuery?</p>

<p>This is my directory </p>

<pre><code>- root
    - css
        popup.css
    - js
        jquery.js
        ajax.js
    - xml
        data.xml
    popup.html
    popup.js
    manifest.json
</code></pre>

<p>my <code>ajax.js</code> reads the xml data and checks if the particular person is registered, if it is, it alerts the user that the username is taken, else i want to register that person on <code>data.xml</code> file.</p>

<pre><code>$(document).ready(function() {
    var account = [];

    $.ajax ({
        url: 'xml/data.xml',
        dataType: 'xml',
        type: 'get',
        cache: 'false',

        success: function ( xml ) {
            // :: Pushing Registered People in Account Array
            $(xml).find('record').each(function(){
            account.push({
                    username: $(this).find('username').text(),
                    master: $(this).find('master').text()
                });
            });

            // :: When Submit Button is Clicked
            $('#submitReg').click(function(){
                var found = false;
                for ( i=0; i&lt;account.length &amp;&amp; !found; ++i ) {
                    if ( account[i]['username'] == $('#usr').val() ) found = true;
                }

                // :: If Username Already Exists
                if ( found ) {
                    $('#errorStatus').html('Username Already Exists');
                    $('#usr').val('');
                    $('#pwd').val('');
                }
                else {
                    // :: Write to file
                }
            });
        }
    });
});
</code></pre>

<p>Files are local and aren't hosted, so i won't be using PHP or ASP.NET for any manner. (EDIT: i.e i want my <code>data.xml</code> to be stored on a computer/laptop/device on who ever is using this extension).</p>

<p>my <code>data.xml</code> is</p>

<pre><code>&lt;?xml version="1.0" ?&gt;

&lt;details&gt;
    &lt;record&gt;
        &lt;username&gt;Danyal Imran&lt;/username&gt;
        &lt;master&gt;1982gonzopracontroli&lt;/master&gt;
    &lt;/record&gt;

    // :: ADD MORE RECORDS HERE 

&lt;/details&gt;
</code></pre>

<p>I want newly Registered Username and Master(Password) be wrapped in a xml format and written to <code>data.xml</code></p>

<p>Registration Page: </p>

<pre><code>&lt;div id="registrationPanel"&gt; 
    &lt;input type="text" class="form-control" id="usr" placeholder="Enter Desired Username"&gt;
    &lt;input type="password" class="form-control" id="pwd" placeholder="Enter Master Password"&gt;
&lt;/div&gt;
</code></pre>