简体   繁体   中英

How do I pass the Variables from Javascript Url

I have a form on filling all the information and it refreshes and go to the same form . which needs 2 parametrs to be passed to the url . Now my problem is I dont want to show 2 params in the url How can I do that? This is the url. $myurl = '/root/subroot/banking.php?a1=test&a2=test2'

I want to change the URL to $myurl = '/root/subroot/banking.php'

Can the two parameters also go through without showing in the Url I mean through any other. I created params in this way Would that help in creatin variables

$('#a1').attr('value', 'test');
$('#a2').attr('value', 'test2'). but did not work out 

Change <form method="get"> to <form method="post">

Edit
If you don't want a1 and a2 to be seen, you can use <input type="hidden" name="a1" value="test" /> (same for a2). Though, just a note this information is visible in the markup and headers sent to the server so if you're hiding something there that you don't want the user to be able to see, you probably don't want to do it this way.

On a sidenote, if you're using jQuery, you might wanna use

$('#a1').val('test');

instead of

$('#a1').attr('value', 'test');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM