# Sending a DOM object to PHP over Ajax

**URL:** <https://forum.kirupa.com/t/sending-a-dom-object-to-php-over-ajax/176240>\
**Category:** web dev\
**Created:** [January 21, 2006, 9:58pm UTC](https://forum.kirupa.com/t/sending-a-dom-object-to-php-over-ajax/176240 "2006-01-21T21:58:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeff\_Wheeler](https://avatars.discourse-cdn.com/v4/letter/j/59ef9b/32.png) [@Jeff\_Wheeler](https://forum.kirupa.com/u/Jeff_Wheeler)\
**Post date:** [January 21, 2006, 9:58pm UTC](https://forum.kirupa.com/t/sending-a-dom-object-to-php-over-ajax/176240/1 "2006-01-21T21:58:28Z")

</div>

Hey guys,

I’ve got a DOM object containing an entire form, and I need to send the entire object to PHP through ajax. It’s important to maintain the values of each input field.

I don’t know what fields are going to be in the form, and that is why I must send the entire form. If there is an alternative, I’m open to it, but I’d prefer to receive xml into the PHP file.

So far, I have something like this:

```javascript
xmlHttp.open("POST",'filename',true);
xmlHttp.send(document.getElementById('element_id'));

```

Is there any method to convert a dom object to a string or xml?

Thanks 🙂

**Note** : This is a commercial project, and I am unable to use any open source software, so please don’t post any ajax libraries.
