Http request error when using AJAX

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rpjanaka
    New Member
    • Oct 2006
    • 10

    Http request error when using AJAX

    Hi all,

    I am using AJAX to submit a data from a web page, it is properly working on the local host (when test with the local machine it is ok).also when access from another machine the pages are properly lord. But when send data it gives an http request error.

    The following is the error message. it include several suggestions, but i cant exactly deiced what it is.?

    pls anyone can help me to find the reason for this...

    Code:
    ERROR
    The requested URL could not be retrieved
    
    While trying to process the request:
    
    POST /OmniPreferedRoaming/Omni%20Preferred%20Roamer/Action/add-operator-action.jsp?action=add&opCountry=CAN&opName=can2&opCC=456&opNDC=6325&opMCC=156&opMNC=0036&sid=0.6507964352578459 HTTP/1.1
    Host: 172.16.7.49:8080
    User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3
    Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
    Accept-Language: en-us,en;q=0.5
    Accept-Encoding: gzip,deflate
    Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
    Keep-Alive: 300
    Proxy-Connection: keep-alive
    Referer: http://172.16.7.49:8080/OmniPreferedRoaming/Omni%20Preferred%20Roamer/add-operator.jsp
    Cookie: JSESSIONID=5692686F83690546771C7B1E7B6B02DF
    Proxy-Authorization: Basic cnBqYW5ha2E6YTdoMzEkNW0=
    Pragma: no-cache
    Cache-Control: no-cache
    
    
    The following error was encountered:
    
        * Invalid Request 
    
    Some aspect of the HTTP Request is invalid. Possible problems:
    
        * Missing or unknown request method
        * Missing URL
        * Missing HTTP Identifier (HTTP/1.0)
        * Request is too large
        * Content-Length missing for POST or PUT requests
        * Illegal character in hostname; underscores are not allowed
    Last edited by acoder; Mar 28 '07, 09:03 AM. Reason: Formatting (tags)
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Post your code.

    Comment

    • rpjanaka
      New Member
      • Oct 2006
      • 10

      #3
      function sendRequest(url ){
      xmlHttp=GetXmlH ttpObject();
      if (xmlHttp==null)
      {
      alert ("Your browser does not support AJAX!");
      return;
      }
      url=url+"&sid=" +Math.random();
      xmlHttp.onready statechange=sta teChanged;
      xmlHttp.open("P OST",url,true) ;
      xmlHttp.send(nu ll);
      }







      function GetXmlHttpObjec t()
      {
      var xmlHttp=null;
      try
      {
      // Firefox, Opera 8.0+, Safari
      xmlHttp=new XMLHttpRequest( );
      }
      catch (e)
      {
      }
      }

      Comment

      • rpjanaka
        New Member
        • Oct 2006
        • 10

        #4
        this error is only reported with the Mozilla browser, when it use IE, there is no error and AJAX functions are working properly...in mozilla browser also it is working if the server also running on the same computer..

        what could be the reason for that...?

        Comment

        • acoder
          Recognized Expert MVP
          • Nov 2006
          • 16032

          #5
          For POST requests you need to send the variables, not null. See link. See if that solves your problem.

          Comment

          • rpjanaka
            New Member
            • Oct 2006
            • 10

            #6
            OK....

            thanks very much ...

            Comment

            Working...