-2

I am new in javascript/jquery, need to hide query strings of anchor tag in my project. Please reply as soon as possible.

<a href="cc/login.htm?loginType=manager">Login</a>

2 Answers2

0

For mouseover, you can add:

<a href="cc/login.htm?loginType=manager" title="Click to login">Login</a>

For hiding querystring in URL, you have to change the way of loginpage. I guess, you could send logintype variable in a POST and render that variable as a hidden value in the login form (and of course rechecking if that user who is logging in has that manager access).

Or you can just JS change the URL:

window.history.pushState('Login', 'Login', 'cc/login.htm');
Community
  • 1
  • 1
Mike B
  • 2,756
  • 2
  • 16
  • 28
  • I gave exact code for the things you can use with html and javascript. for changing the way of showing login page I gave you the idea (what is the purpose of this site), not giving you all the code all the time for copy/pasting. But given examples should work anyway (if you don't want to go the long way – Mike B Sep 01 '16 at 09:09
  • Mr. Mikelis Baltruks, i didn't get your code snippet. If you give like this code snippet then it will be useless – Kartika Pradhan Sep 01 '16 at 09:43
  • If any body asking questions then try to justify the question otherwise just leave it if you cant. – Kartika Pradhan Sep 01 '16 at 09:46
0

Don't store the url in the href and use Ajax to fill in the url and do the GET or jquery/JS to set the document.location.href

$("#linkid").on('click', function (e) {

    e.preventDefault();

    var loadUrl = "cc/login.htm?loginType=manager";  
    document.location.href = loadUrl;

    return false;       

});     
Scary Wombat
  • 44,617
  • 6
  • 35
  • 64
  • Mr Scary Wombat i want solution of my question, not just code snippet – Kartika Pradhan Sep 01 '16 at 09:49
  • @KartikaPradhan - the code "snippet" shown in this answer is a reasonably complete solution to the requirement you described in your question. You don't need to "call" that code, it will work on its own though you'd need to give your anchor element an appropriate id attribute. Stack Overflow isn't intended as a free code-writing service, it's a site for *programmers* to get help with specific problems, so you are expected to put in *some* effort yourself if necessary to take a general solution and apply it to your own project. – nnnnnn Sep 01 '16 at 11:33
  • `give code snippet` `i want solution of my question, not just code snippet` `code is not working` - Do you understand the code snippet? Even though people help you, you still have to make some effort yourself - even saying how it does not work and what exactly you have tried. – Scary Wombat Sep 02 '16 at 01:17