This is a follow up question to this answer:
JavaScript/jQuery:
var xmlDoc = jQuery.createXMLDocument( "<items></items>" );
jQuery( "items", xmlDoc ).append( jQuery( "<item>My item!</item>" ) );
jQuery.ajax({
url: "test.php",
type: "POST",
processData: false,
contentType: "text/xml",
data: xmlDoc,
success: function( data ) {
alert( data );
}
});
PHP:
$xml_text = file_get_contents("php://input");
$xml = simplexml_load_string($xml_text);
echo $xml->ITEM;
In order for this to work I have to use $xml->ITEM. If I use $xml->item it will not work. I was wondering why when the item node gets appended it is lowercase, but when I retrieve it, it now has to be uppercase? I would like it to be lowercase in my PHP. Thanks.