Forum Moderators: open

Message Too Old, No Replies

submit xml file to a url as a request

for UPS tracking we have to submit XML request

         

Jaunty Edward

10:41 pm on Mar 30, 2007 (gmt 0)

10+ Year Member



HI,
its been a long time since I have been working on this, UPS wants me to submit the request as an xml file to their API.

After a lot of googling I found this code:

var request = new HttpRequest();
request.open("POST", "https://www.ups.com/ups.app/xml/Track", false);
request.setRequestHeader("Content-Type", "text/xml");
request.send("<message>Hello World!</message>"); //this is my xml request

I use the above code to send a xml request, but it does not return anything, I think the code is incomplete... can anyone help me.

thanks
bye

[edited by: Jaunty_Edward at 11:04 pm (utc) on Mar. 30, 2007]

cmarshall

2:26 am on Mar 31, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You are probably best off asking this question on the JavaScript and AJAX Forum [webmasterworld.com].

The problem isn't with your XML. It is with your AJAX submitting code, which isn't very well-done.

I'd actually question whether or not you even need to use AJAX to submit the form. It's probably easier.

cmarshall

12:43 pm on Mar 31, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Duh. I spaced out.

It's probably easier to do this with a non-AJAX

<form>
element, thusly:

<form method="post" action="https://www.ups.com/ups.app/xml/Track"><div>
<input type="hidden" name="whatever UPS wants" value="insert form data here" />