Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-20-2010, 04:05 AM   PM User | #1
dniwebdesign
Regular Coder

 
dniwebdesign's Avatar
 
Join Date: Dec 2003
Location: Carrot River, Saskatchewan
Posts: 838
Thanks: 15
Thanked 9 Times in 9 Posts
dniwebdesign is an unknown quantity at this point
Sending XML via $.ajax, but specifing POST name.

Don't know if the title made any sense, but here's my problem.
I have the following code:
Code:
		$.ajax({
               //url: "http://sellonline.canadapost.ca:30000"
			   	 url: "test.php"
               , type: "POST"
               , processData: false
			   , data: xmlDocument
               , success: function(responsed) {
				    alert("Returned\n---------------------\n"+responsed);
			   }
			   , error:function(xhr,err){
					alert("readyState: "+xhr.readyState+"\nstatus: "+xhr.status+"\ntext: "+xhr.statusText);
					alert("responseText: "+xhr.responseText);
				}
			  
        });
Which, at present time works fine... the test.php only has
PHP Code:
<?php
    print_r
($_POST);
?>
which again works fine. Returns the xml document in the $_POST array that I sent.

However, I need to send this with the key "XMLRequest". As if the XML was in a textarea with name="XMLReqeust".
Basically, I want to do what they do here. http://sellonline.canadapost.ca/Deve...Interface.html Only via AJAX, which should work, no?

I've tried data: ({ 'XMLRequest': xmlDocument }) but with no success.

Is there any way to do this. I've tried searching the jQuery API but they're very limited on how this works. Thanks.
__________________
Dawson Irvine
CEO - DNI Web Design
http://www.dniwebdesign.com
dniwebdesign is offline   Reply With Quote
Old 01-20-2010, 04:43 PM   PM User | #2
Fumigator
UE Antagonizer


 
Fumigator's Avatar
 
Join Date: Dec 2005
Location: Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
Posts: 7,686
Thanks: 42
Thanked 637 Times in 625 Posts
Fumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of light
Isn't the format data: "name=value"? So in your case, this should work:

PHP Code:
 data"XMLRequest=" xmlDocument 
__________________
Fumigator is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:09 PM.


Advertisement
Log in to turn off these ads.