i get the values from database for email field when blur function it gives alert message. In that alert message if i click ok means it will get the profile and show in my view..Is it possible?
Jquery code:
<a id="checkEmail" href="#" ></a> | <a id="getCandidate"></a>
<script type ="text/javascript">
$('#getCandidate').text('Get Profile') // Sets text for email.
.attr('href', '#');
$("#Email").blur(function () {
$('#checkEmail').trigger('click');
$('#getCandidate').text('Get Profile')
.attr('href', 'GetCandidateDetail?validateEmail=' + $('#Email').val());
});
$(document).ready(function () {
$('#checkEmail').click(function () {
var name = $('#Email').val();
var data = 'validateEmail=' + name;
$.ajax({
type: "GET",
url: "ValidateCandidate",
data: data,
success: function (data) {
alert(data);
}
});
return false;
});
});
</script>
I found the result.. Just pass the url in ajax post like the following,
<script>
$(document).ready(function () {
$('#emailcheck').click(function () {
var name = $('#Email').val();
var data = 'getemail=' + name;
$.ajax({
type: "GET",
url: "geturl",
data: data,
success: function (data) {
window.location = "/home/homeurl/GetDetails?email=" + name;
alert(data);
}
});
return false;
});
});
</script>
It is possible if you use confirm box. It is the example code.
<a id="checkEmail" href="#" ></a> | <a id="getCandidate"></a><script type ="text/javascript">
$('#getCandidate').text('Get Profile') // Sets text for email.
.attr('href', '#');
$("#Email").blur(function () {
$('#checkEmail').trigger('click');
$('#getCandidate').text('Get Profile')
.attr('href', 'GetCandidateDetail?validateEmail=' + $('#Email').val());
});
$(document).ready(function () {
$('#checkEmail').click(function () {
var name = $('#Email').val();
var data = 'validateEmail=' + name;
$.ajax({
type: "GET",
url: "ValidateCandidate",
data: data,
success: function (data) {
if (confirm("Press a button!"))
{
//Do you changes
}
}
});
return false;
});
});
</script>
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.