el metodo ajax completo @section Scripts { @Scripts.Render("~/bundles/jqueryval")
<script type="text/javascript">
$(document).ready(function () {
$("#SearchSubjectBtn").click(function () {
alert("se dio click en el boton");
var SearchBySubject = $("#SearchBySubject").val();
var SearchSubject = $("#SearchSubject").val();
var SetDataSubject = $("#DataSearchingSubject");
$.ajax({
type: "POST",
url: "/Generic/GetSubject?SearchBy=" + SearchBySubject + "&SearchValue=" + SearchSubject,
contentType: "html",
success: function (result) {
console.log(result);
if (result.length == 0) {
window.alert("no se encontro la materia");
SetDataSubject.append('<tr style="color:red"><td colspan="3">No se encontro la materia</td></tr>')
}
else {
$.each(result, function (i, value) {
var Data = "<tr>" +
"<td>" + value.NameSubject + "</td>" +
"<td>" + value.NameLevel + "</td>" +
"<td>" +
"<input type='button' onclick='PasarMateria(" + value.SubjectId + ",'" + value.NameSubject + "' )' class='btn btn-warning' value='Seleccionar' data-dismiss='modal'>" +
"</td>" +
"</tr>";
SetDataSubject.append(Data);
});
}
}
});
});
});
function PasarUsuario(UserId, nombre) {
$("#txtUsuario").val(UserId);
$("#borrartxt").val(nombre);
document.getElementById('borrartxt').innerHTML = nombre;
console.log(UserId);
}
function PasarMateria(SubjectId, NameSubject) {
console.log('SubjectId', typeof SubjectId);
console.log('NameSubject', typeof NameSubject);
$("#SubjectTxt").val(SubjectId);
$("#SubjectLbn").val(NameSubject);
console.log(SubjectId);
}
</script>
}
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
<script type="text/javascript">
$(document).ready(function () {
$("#SearchSubjectBtn").click(function () {
alert("se dio click en el boton");
var SearchBySubject = $("#SearchBySubject").val();
var SearchSubject = $("#SearchSubject").val();
var SetDataSubject = $("#DataSearchingSubject");
$("#SearchSubjectBtn").click(function ajax() {
alert("se dio click en el boton"); type: "POST",
var url: "/Generic/GetSubject?SearchBy=" + SearchBySubject =+ $("#SearchBySubject").val();"&SearchValue=" + SearchSubject,
var SearchSubject = $("#SearchSubject").val contentType: "html",
success: function (result); {
var SetDataSubject = $ console.log("#DataSearchingSubject"result);
$.ajax({
if (result.length == type:0) "POST",{
url: "/Generic/GetSubject?SearchBy=" + SearchBySubject + "&SearchValue=" + SearchSubject,
window.alert("no se encontro la materia");
contentType: "html",
SetDataSubject.append('<tr successstyle="color:red"><td functioncolspan="3">No (result)se {encontro la materia</td></tr>')
console.log(result); }
if (result.length == 0) {
window.alert("no se encontro la materia");
SetDataSubject.append('<tr style="color:red"><td colspan="3">No se encontro la materia</td></tr>')
else }{
else $.each(result, function (i, value) {
var Data = "<tr>" +
"<td>" + value.NameSubject + "</td>" +
"<td>" + value.NameLevel + "</td>" +
"<td>" +
"<input type='button' onclick='PasarMateria(" + value.SubjectId + ",'" + value.NameSubject + "' )' class='btn btn-warning' value='Seleccionar' data-dismiss='modal'>" +
"</td>" +
"</tr>";
$.each(result, function (i, value) {
var Data = "<tr>" +
"<td>" + value.NameSubject + "</td>" +
"<td>" + valueSetDataSubject.NameLevel + "</td>" +
"<td>" +
"<input type='button' onclick='PasarMateriaappend(" + value.SubjectId + ",'" + value.NameSubject + "' Data)' class='btn btn-warning' value='Seleccionar' data-dismiss='modal'>" +;
"</td>" +});
"</tr>";}
SetDataSubject.append(Data);
});
}
});
}
});
});
});
function PasarUsuario(UserId, nombre) {
$("#txtUsuario").val(UserId);
$("#borrartxt").val(nombre);
document.getElementById('borrartxt').innerHTML = nombre;
function PasarUsuario console.log(UserId, nombre) {;
$("#txtUsuario").val(UserId);
$("#borrartxt").val(nombre);
document.getElementById('borrartxt').innerHTML = nombre;}
console.logfunction PasarMateria(UserIdSubjectId, NameSubject); {
} console.log('SubjectId', typeof SubjectId);
console.log('NameSubject', typeof NameSubject);
function PasarMateria $("#SubjectTxt").val(SubjectId,);
$("#SubjectLbn").val(NameSubject);
{
console.log(SubjectId);
$("#SubjectTxt").val(SubjectId);}
$("#SubjectLbn").val(NameSubject);</script>
}
@section Scripts {
console @Scripts.logRender(SubjectId"~/bundles/jqueryval");
<script type="text/javascript">
$(document).ready(function () {
$("#SearchSubjectBtn").click(function () {
alert("se dio click en el boton");
var SearchBySubject = $("#SearchBySubject").val();
var SearchSubject = $("#SearchSubject").val();
var SetDataSubject = $("#DataSearchingSubject");
$.ajax({
type: "POST",
url: "/Generic/GetSubject?SearchBy=" + SearchBySubject + "&SearchValue=" + SearchSubject,
contentType: "html",
success: function (result) {
console.log(result);
if (result.length == 0) {
window.alert("no se encontro la materia");
SetDataSubject.append('<tr style="color:red"><td colspan="3">No se encontro la materia</td></tr>')
}
else {
$.each(result, function (i, value) {
var Data = "<tr>" +
"<td>" + value.NameSubject + "</td>" +
"<td>" + value.NameLevel + "</td>" +
"<td>" +
"<input type='button' onclick='PasarMateria(" + value.SubjectId + ",'" + value.NameSubject + "' )' class='btn btn-warning' value='Seleccionar' data-dismiss='modal'>" +
"</td>" +
"</tr>";
SetDataSubject.append(Data);
});
}
}
});
});
});
function PasarUsuario(UserId, nombre) {
$("#txtUsuario").val(UserId);
$("#borrartxt").val(nombre);
document.getElementById('borrartxt').innerHTML = nombre;
console.log(UserId);
}
function PasarMateria(SubjectId, NameSubject) {
$("#SubjectTxt").val(SubjectId);
$("#SubjectLbn").val(NameSubject);
console.log(SubjectId);
}
</script>
}
}