1

I have the following $.ajax POST code:

$.ajax({
    type: 'POST',
    url: submitUrl,
    data: xml,
    dataType:'xml',
    beforeSend:function() {
        console.log(submitUrl);
    },
    success:function(data) {
        console.log(data);
    },
    error:function(error) {
        console.log(error);
    }
}); 

If I wanted to perform the same function in PHP what would be the code?

I've like to be able to swap out the URL to be a URL on my server, I suppose in some ways using my server as a proxy to perform the post and avoid the 'origin' issues of trying to post this data from the client.

The data I'm posting is a string of XML text, so I need to pass the XML to the PHP script and the do the post server side. I then need the PHP script to pass back either and error of success message to the client.

I'll still have the ajax code client side but it will call my server rather than going cross domain.

CLiown
  • 13,665
  • 48
  • 124
  • 205

0 Answers0