Avatar of ITsolutionWizard
ITsolutionWizardFlag for United States of America

asked on 

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

HTMLJavaScriptjQuery

Avatar of undefined
Last Comment
Chris Stanyon
Avatar of Chris Stanyon
Chris Stanyon
Flag of United Kingdom of Great Britain and Northern Ireland image

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.
Avatar of ITsolutionWizard

ASKER

i want to first save the email into local storage, then redirect to that webpage. Is it possible?
Avatar of Chris Stanyon
Chris Stanyon
Flag of United Kingdom of Great Britain and Northern Ireland image

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

Avatar of ITsolutionWizard

ASKER

And I just don't want to use local host any more can I add .. ?
ASKER CERTIFIED SOLUTION
Avatar of Chris Stanyon
Chris Stanyon
Flag of United Kingdom of Great Britain and Northern Ireland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
JavaScript
JavaScript

JavaScript is a dynamic, object-based language commonly used for client-side scripting in web browsers. Recently, server side JavaScript frameworks have also emerged. JavaScript runs on nearly every operating system and in almost every mainstream web browser.

127K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo