Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Jan 2011
    Posts
    42
    Thanks
    1
    Thanked 0 Times in 0 Posts

    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.

  • #2
    Regular Coder hdewantara's Avatar
    Join Date
    Aug 2009
    Location
    Jakarta, Indonesia.
    Posts
    330
    Thanks
    9
    Thanked 50 Times in 49 Posts
    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?

  • #3
    GŁtkodierer
    Join Date
    Apr 2009
    Posts
    2,127
    Thanks
    1
    Thanked 426 Times in 424 Posts
    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.

  • #4
    New Coder
    Join Date
    Jan 2011
    Posts
    42
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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.

  • #5
    Senior Coder
    Join Date
    Dec 2010
    Posts
    2,355
    Thanks
    11
    Thanked 558 Times in 551 Posts
    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 ...


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •