I'm trying to take some XML I receive from an AJAX call (via a "GET"),
manipulate it, then POST the document to an ASP.NET page.  My "get"
looks like this:

        var createNewUsersExtendedAttributes = function()
        {
                $.ajax({
                    type: "GET",
                    url: "<someURL>",
                    dataType: "xml",
                    cache: false,
                    success: processExtendedAttributes(xml),
                    error: function() {
                        // handle error
                    }
                });

        }

        processExtendedAttributes = function(xml)
        {
                // set a member variable in this class
                userProfileExtendedAttributes = $(xml);
        }

Elsewhere in my code, I manipulate nodes in the member variable
"userProfileExtendedAttributes".  All of this works great.  However, I
have problems when I want to take that XML document and do a POST with
it:

                $.ajax({
                        type: "POST",
                        url: "<someURL>",
                        processData: false,
                        contentType: "text/xml",
                        // remember, the userProfileExtendedAttributes
variable was assigned in the above success callback using $(xml)
                        data: userProfileExtendedAttributes,
                        success: function(data)
                        {
                                alert('success!');
                        },
                        error: function(request,status,errorThrown)
                        {
                                alert('failure!');
                        }
                });

I've played with the usual suspects (processData, contentType, etc.),
and they are not fixing the issue.  If I debug the page to which I'm
posting (or look at HTTP headers being sent to the page), I get
nothing in terms of posted data (note: if I put simple name/value
pairs in the data parameter, I do see those).  I understand that when
I call the function that uses the post code above, the member variable
"userProfileExtendedAttributes" is NOT a string representation of the
XML document (it's actually a reference to a jQuery instance of an XML
document).  I believe this issue is happening because I'm not sending
an XML string to the page I'm posting to, however, I cannot for the
life of me figure out how to get this XML document serialized so that
I can post it.  Any help would be greatly appreciated!

Reply via email to