mvc, html 5, email

Below codes is on index.html
and how can i carry the id=search value to http://localhost:5489/Quote/BondInfo?

<form role="form"  class="search-form" method="post">
												<div class="form-group">
													<input type="text"  class="form-control" id="search" placeholder="Get our prices. Enter your email">
													<button onclick="fnNext()" class="btn btn-theme" type="button">
														Submit <i class="fa fa-chevron-right"></i>
													</button>
                                                    <script>
                                                        function fnNext() {

                                                            window.location.replace("http://localhost:5489/Quote/BondInfo");
                                                      }
                                                    </script>
                                                    <br />
                                                   <label style="color:white;" >Your Information is safe & secure</label>
												</div>
											</form>

Open in new window

LVL 1
ITsolutionWizardAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Chris StanyonWebDevCommented:
If you're using jQuery, I would advise you start using the unobtrusive event binding, so rather than binding in the button's onClick event, you just use jQuery. Give your button an ID and then bind then event:

//HTML
<input type="text"  class="form-control" id="search" placeholder="Get our prices. Enter your email">
<button class="btn btn-theme" id="gotoNext">Submit <i class="fa fa-chevron-right"></i></button>

Open in new window

//Jquery
$('#gotoNext').click(function() {
    var url = 'http://localhost:5489/Quote/BondInfo?search=' + $('#search').val();
    window.location.replace(encodeURI(url));
});

Open in new window

If you want to carry on with your raw Javascript, then you can get the search value with a call to getElementById.
0
ITsolutionWizardAuthor Commented:
i want to first save the email into local storage, then redirect to that webpage. Is it possible?
0
Chris StanyonWebDevCommented:
Sure - just store it in localStorage before doing the redirect:

$('#gotoNext').click(function() {
    var email = $('#search').val();
    var url = 'http://localhost:5489/Quote/BondInfo?search=' + email;
    localStorage.setItem('emailAddress', email);
    window.location.replace(encodeURI(url));
});

Open in new window

0
ITsolutionWizardAuthor Commented:
And I just don't want to use local host any more can I add .. ?
0
Chris StanyonWebDevCommented:
Don't know what you mean.

If you don't want your URL to be based on localhost, then just remove it and put in the new URL
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.