无法使用jquery将xml数据发布到服务器端(php)

what i am doing is:

  1. reading a xml file with ajax get method

  2. and then updating a particular node value of xml

  3. after updating this xml response i am posting it to the server side (php) for writing that xml file again

i am getting error in posting the updated xml response to server side the error is: NS_ERROR_XPC_BAD_CONVERT_JS: Could not convert JavaScript argument

i found this accepted answer but this didn't work for me: How to change the value of an xml node with jquery?

here is my somecode:

$.ajax({
                url: "<?php echo $xmlFilePath;?>",
                type: "GET",
                dataType: "xml",
                success: function(xml){    

                    $(xml).find("Page[id='1']").each(function(){
                       $(this).find('ContentOne').text("New Value");
                    });

                 $.post('<?php echo base_url(); ?>contentadd', { xml: escape($(xml))}, function(data){alert("Data Loaded: " + data);});

                }
        });

any quick response will be helpfull

Instead of escape I would try to serialize xml with jQuery and unserialize it on server side...