According to the PHP code, it is writing some uploaded xml content to a file on server. This is the job of a server-side script like PHP. jQuery, on the other hand, cannot do this, jQuery, which is a library of JavaScript, belongs to client-side scripting, which means it only runs on the browser. You may upload a file using jQuery Ajax from the browser and be processed by PHP on the server. See example:
http://abandon.ie/notebook/simple-file-uploads-using-jquery-ajax[
^]