This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form> | |
<label for="Nome">Nome:</label> | |
<input type="text" id="Nome" name="Nome" /> | |
<label for="Email">E-mail:</label> | |
<input type="text" id="Email" name="Email" /> | |
<input type="button" id="Botao" name="Botao" value="Serializar" /> | |
</form> | |
<div id="Resultado" style="color: red;"></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function MostraFormSerializado() { | |
var Res = $("form").serialize(); | |
$("#Resultado").text(Res); | |
} | |
$("input[type='button']").on("click", MostraFormSerializado); | |
//MostraFormSerializado(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Usuarios | |
{ | |
public string Nome { get; set; } | |
public string Email { get; set; } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public ActionResult Index() | |
{ | |
return View(); | |
} | |
[HttpGet] | |
public JsonResult ProcessaFormulario(Usuarios Usuario) | |
{ | |
return Json(new { OK = true, Nome = Usuario.Nome, Email = Usuario.Email }, JsonRequestBehavior.AllowGet); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@{ | |
Layout = null; | |
} | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="viewport" content="width=device-width" /> | |
<title>Serialização</title> | |
</head> | |
<body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="http://code.jquery.com/jquery-1.9.1.js"></script> | |
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.js" ></script> | |
<script type="text/javascript"> | |
$(document).ready(function () { | |
$("#formulario").validate({ | |
rules: { | |
Nome: { | |
required: true | |
}, | |
Email: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void Main(string[] args) | |
{ | |
String Valor = ""; | |
List<string> Valores = new List<string>(); | |
Console.WriteLine("Olá. Seja bem vindo a esta calculadora.\n"); | |
Console.WriteLine("Diga-nos, qual operação (+, -, *, /) deseja realizar?\n"); | |
string Operador = Console.ReadLine(); | |
Operador = ValidaEntradaDeOperador(Operador); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static string ValidaEntradaDeOperador(string Operador) | |
{ | |
while (Operador != "+" && Operador != "-" && Operador != "*" && Operador != "/") | |
{ | |
Console.WriteLine("Desculpe, mas este operador não é válido. Informe o operador novamente agora:"); | |
Operador = Console.ReadLine(); | |
} | |
return Operador; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static string MontaRespostaDaOperacaoMatematica(string Parametro) | |
{ | |
//Console.WriteLine("O resultado da operaÁ„o matem·tica È: " + Parametro); | |
//Console.ReadLine(); | |
return Parametro; | |
} | |
private static string ValidaEntradaDeOperador(string Operador) | |
{ | |
while (Operador != "+" && Operador != "-" && Operador != "*" && Operador != "/") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static string MontaRespostaDaOperacaoMatematica(string Parametro) | |
{ | |
return Parametro; | |
} |
OlderNewer