CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Sep 2004
    Location
    .hell On Earth.
    Posts
    91

    POST Method - AJAX

    Hellos all,

    Got a question about the POST Method..

    I got a file (test.php) were i got a textbox and a button (the button calls a js function testy)

    Code:
    function testy(){
    xmlHttp=GetXmlHttpObject()
    if (xmlHttp==null) {
     alert('Your browser does not support AJAX. Contact your system administrator.');
     return
    }
    var url="testx.php"
    url=url+"?ach=test"
    url=url+"&sav="+document.getElementById('sav').value
    xmlHttp.onreadystatechange=stateChangedX
    xmlHttp.open("POST",url,true)
    xmlHttp.send(null)	
    }
    my problem is that in firebug i can see the URL when i use

    Code:
    xmlHttp.open("POST",url,true)
    or


    Code:
    xmlHttp.open("GET",url,true)
    How can i completely hide the URL from the user?

    thanks

  2. #2
    Join Date
    May 2002
    Posts
    10,943

    Re: POST Method - AJAX

    If you're using AJAX, there is no URL visually shown. However, if there is a URL logging system (GET only), or the user decodes some JavaScript, the URL could easily be discovered.

    Remember that most browsers will also include a console which lists all current web activity as well. If you're worried about URL security, then you simply cannot access it. If it's just for user simplicity, then the method you use is unimportant. That is unless you're sending large amounts of data in which a URL max length would be reached so you'd have to use POST.
    Last edited by PeejAvery; September 13th, 2011 at 11:31 PM.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  3. #3
    Join Date
    Sep 2004
    Location
    .hell On Earth.
    Posts
    91

    Re: POST Method - AJAX

    my main problem is that when i send the password even though the input type is "password" i can still see it in the console of firebug. How do you solve this?

  4. #4
    Join Date
    May 2002
    Posts
    10,943

    Re: POST Method - AJAX

    Hence why I mentioned that URL logging shows up in GET only. Secure data needs to be passed always with POST!
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  5. #5
    Join Date
    Sep 2004
    Location
    .hell On Earth.
    Posts
    91

    Re: POST Method - AJAX

    Quote Originally Posted by PeejAvery View Post
    Hence why I mentioned that URL logging shows up in GET only. Secure data needs to be passed always with POST!
    I tried the POST method and it still shows up in the console of firebug

  6. #6
    Join Date
    May 2002
    Posts
    10,943

    Re: POST Method - AJAX

    That's because you're just changing the word "GET" to "POST" but not the URL nor the passed

    Code:
    var parameters = "p1=v1&p2=v2";
    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.setRequestHeader("Content-length", parameters.length);
    xmlHttp.setRequestHeader("Connection", "close");
    xmlHttp.send(parameters);
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  7. #7
    Join Date
    May 2002
    Posts
    10,943

    Re: POST Method - AJAX

    [ moved thread ]
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  8. #8
    Join Date
    Sep 2004
    Location
    .hell On Earth.
    Posts
    91

    Re: POST Method - AJAX

    thanks man.. i had wrong spellings that were messing things up

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured