homepage Welcome to WebmasterWorld Guest from 54.234.74.85
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
[ajax] send data with POST and getting back xml
fm86




msg:4299521
 8:57 pm on Apr 17, 2011 (gmt 0)

Hi everybody!

I have a page with a textarea and I want to send it to a PHP script as a POST variable so that I can store it into a database and then getting back an xml files which contains the result of the operation.

My ajax code looks like this:
xhr.open("POST", strName, true);
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhr.overrideMimeType('text/xml');
xhr.send(parameters);


This works well in FF but in IE I get an error. Apparently the object is not correctly created. Where am I wrong?

Probably it's a common problem but I searched the forum and didn't find anything...
Thanks for your help!

 

astupidname




msg:4299530
 9:30 pm on Apr 17, 2011 (gmt 0)

IE does not support overrideMimeType so change
xhr.overrideMimeType('text/xml');

to:
if (xhr.overrideMimeType) {
xhr.overrideMimeType('text/xml');
}

fm86




msg:4299536
 9:37 pm on Apr 17, 2011 (gmt 0)

Thanks a lot!
Quoting a popular movie: "You are my personal Jesus Christ" :)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved