2
Arquivopai.cshtml is as follows:
<html>
<head></head>
<body>
<!-- Nesta div pretendo abrir minha popup -->
<div id="popup"></div>
<!-- Com este link pretendo acionar a abertura da popup -->
<a id="open">Abrir PopUp</a>
<script type="text/javascript">
$("#open").click(function () {
$.ajax({
type: 'GET',
url: '/Usuario/arquivoFilho',
success: function (data) {
$('#popup').html(data);
$('#popup').show();
}
});
});
</script>
</body>
</html>
How I’m working with ASP.NET MVC, when I write: url: "'/Usuario/arquivoFilho',"
in the method $ajax()
, I am saying that I have a controller named user and inside it an Action (function/method) called fileFile, which is found as follows:
namespace WebApplication1.Controllers
{
public class UsuarioController : Controller
{
public ActionResult arquivoFilho()
{
return View();
}
}
}
This action arquivoFilho()
, redirects by default to the "fileFile.cshtml" view (This redirect happens because I created the view from the method), which has the content I intend to display in the popup. The file "filename.cshtml" is found as follows:
<html>
<head></head>
<body>
<h2>Editar Usuário</h2>
@using (Html.BeginForm("Index", "Usuario", new { ReturnUrl = ViewBag.ReturnUrl },
FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
{
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
@Html.HiddenFor(x => x.login)
<div class="editor-label">
@Html.LabelFor(model => model.login)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.login)
@Html.ValidationMessageFor(model => model.login)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.senha)
</div>
<div class="editor-label">
@Html.EditorFor(model => model.senha)
@Html.ValidationMessageFor(model => model.senha)
</div>
<p><input type="submit" value="Save" /></p>
}
</body>
</html>
The fact is that it’s not working.
put more details so that we can understand if any javascript error is occurring or in your Editusuario action
– anmaia
Blz Tiago Silva, I’ll try Alert().
– Michell
I just did a reprint of my problem with a little more detail.
– Michell
Hi, Michell, welcome to [en.so]. Formatting here is with Markdown, check out the guide: http://answall.com/editing-help
– brasofilo