Go Back   CodingForums.com > :: Client side development > JavaScript programming > Ajax and Design

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 03-03-2011, 05:28 PM   PM User | #1
htmlster
New Coder

 
Join Date: Jan 2011
Posts: 42
Thanks: 1
Thanked 0 Times in 0 Posts
htmlster is an unknown quantity at this point
POST does not work in Firefox but works in chrome

Hi,

I'm making a ajax call as

xmlhttp.setRequestHeader ("Content-Type", "application/x-www-form-urlencoded");

xmlhttp.open ("POST", url);

xmlhttp.send (parameters);

url, parameters are already declared.

When this code is executed. post works fine (parameters are being set in application) in chrome, but not in firefox.


When i looked through the contents through sniffer (wireshark).

I found out that
in Firefox:
Content-Type: application/x-www-form-urlencoded; char-set: UTF-8

Where as in chrome:
Content-Type: application/x-www-form-urlencoded

does char-set affects post call?. If yes, how can i call request header to not to set "char-set"


Can any one please let me know how i can proceed with this.
htmlster is offline   Reply With Quote
Old 03-04-2011, 10:25 AM   PM User | #2
hdewantara
Regular Coder

 
hdewantara's Avatar
 
Join Date: Aug 2009
Location: Jakarta, Indonesia.
Posts: 289
Thanks: 5
Thanked 40 Times in 40 Posts
hdewantara is an unknown quantity at this point
I would try to post form through regular form using firefox first;
then if it is successful, moved it to ajax method.

Is yours uploading files too?
hdewantara is offline   Reply With Quote
Old 03-04-2011, 03:10 PM   PM User | #3
venegal
Gütkodierer


 
Join Date: Apr 2009
Posts: 2,127
Thanks: 1
Thanked 426 Times in 424 Posts
venegal has a spectacular aura aboutvenegal has a spectacular aura about
Please elaborate on what "post does not work" exactly means, and provide a link to a live example, so we can see the server response.
venegal is offline   Reply With Quote
Old 03-10-2011, 06:02 AM   PM User | #4
htmlster
New Coder

 
Join Date: Jan 2011
Posts: 42
Thanks: 1
Thanked 0 Times in 0 Posts
htmlster is an unknown quantity at this point
Sorry for the confusion.

When i make call as below from javascript:

xmlhttp.setRequestHeader ("Content-Type", "application/x-www-form-urlencoded");

xmlhttp.open ("POST", url);

xmlhttp.send (parameters);

And observed in sniffer (wireshark):

I found out that when the html file which calls the above javascript is opened
in Firefox:
Content-Type is observed as:
Content-Type: application/x-www-form-urlencoded; charset: UTF-8

Where as in chrome:
Content-Type is observed as:
Content-Type: application/x-www-form-urlencoded

I want to avoid, 'charset: UTF-8" string set for Content-Type.

Is there any way with setRequestHeader function so that charset:UTF-8 can be removed for Content-Type?.

The webserver which i have can only understand "Content-Type: application/x-www-form-urlencoded"

I dont have any live link to demonstrate this.


Let me know if any thing is not clear.

Please help me out in resolving this.
htmlster is offline   Reply With Quote
Old 03-10-2011, 06:40 AM   PM User | #5
devnull69
Senior Coder

 
Join Date: Dec 2010
Posts: 2,261
Thanks: 10
Thanked 533 Times in 527 Posts
devnull69 will become famous soon enough
So what is the actual charset you want to use here? If it is ISO-8859-1 you can write this:
Code:
xmlhttp.setRequestHeader ("Content-Type", "application/x-www-form-urlencoded; charset: ISO-8859-1");
Don't be misled by the Chrome Content-type. Even if no charset is specified there is still one charset being used. You will have to find out which one ...
devnull69 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 06:13 AM.


Advertisement
Log in to turn off these ads.