i'm trying to populate textbox value based on another textbox but i cannot populate the the other textbox. i'm sharing my code please guide me with best solution
Action Method:
[HttpGet]
public ActionResult GetInfo(string Email)
{
var result = (from c in db.Customers
where c.Email.ToLower().Contains(Email.ToLower())
select new { c.FirstMidName }).Take(6);
return Json(result, JsonRequestBehavior.AllowGet);
}
Script:
$(document).ready(function () {
var Email;
$(function () {
$("#Email").keydown(function () {
Email = $("#Email").val();
$.ajax({
type: "GET",
url: 'Admin/Ticket/GetInfo',
data: { Email: Email },
success: function (data) {
if (data) {
alert(data);
$('#Phone').text(data);
}
}
});
});
});
i have searched internet but couldn'd find any suitable solution. please guide me with this
document.ready, but you said that's fixed). Could you elaborate on what happens when you try it? Does the ajax call get sent out? Does it return? Do you get the alert? What error do you get?