0

I have use Ajax and jquery for get data from database and send data, but when we use ajax or jquery methods, web page source view ,we can see details like below;

Ajax

<script type="text/javascript">
function showUser()
function showUser()
{
var str = document.getElementById('txtusername').value;
if (str=="")
{
document.getElementById("txtHint").innerHTML="<span style='color:#FFF;font-size:10px;'>Enter username</span>";
return;
} 
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","chkusername.php?q="+str,true);
xmlhttp.send();
}
</script>

In here you can see the get method and what are the sending values and also more things. I want hide these thing from source view, help me ..

4
  • 2
    You really should look into using jQuery. It would make your life a lot easier. Commented May 12, 2012 at 20:58
  • Which "details" would you like to hide? Looks like that's the minimum code required to do what you're trying to do. Commented May 12, 2012 at 21:07
  • 1
    IE5? Didn't know anyone still cared about that .000001% of people. Commented May 12, 2012 at 21:07
  • I want to user registration form and login form but now people like fill all details in one page and.. registered Susses details also on that page without page refreshing.. what is the best method for that ? Commented May 12, 2012 at 21:28

1 Answer 1

3

You can't. Anything on the client side (HTML, CSS, JavaScript) is free for the user to see.

That's why anything security-related is on the server side, where it can be trusted (for the most part).

It's not a security risk if the user knows that to log in you go to /chkusername.php?q=username (or whatever). It is one, however, if you don't properly sanitise the input.

Sign up to request clarification or add additional context in comments.

1 Comment

thank you,..for answer .. if we create login page or registration page is this method is good ?? or are their more methods ?? how to do it in meager web site ?? how they do it ?? help mee

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.