消息未在跨度内打印 [英] message is not printing inside the span
问题描述
我的index.cshtml视图
@model MvcApplication91.vikrant
@ {
ViewBag.Title =索引;
}
索引
< script src =@ Url.Content(〜/ Scripts / jquery.validate.min。 js)type =text / javascript>< / script>
< script type =text / javascript>
$(#Create)。点击(function()
{
var url =/ Home / Index;
var name = $(#name)。val();
var address = $(#address)。val();
$。 post(url,{name:Name,address:Address},function(data)
{
$(#msg)。html(data);
})
})
< / script>
< script src =@ Url.Content(〜/ Scripts / jquery.validate.unobtrusive.min.js)type =text / javascript>< / script>
@使用(Html.BeginForm()){
@ Html.ValidationSummary(true)
vikrant
< br $>
my index.cshtml view
@model MvcApplication91.vikrant
@{
ViewBag.Title = "Index";
}
Index
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script type ="text/javascript">
$("#Create").click( function()
{
var url = "/Home/Index";
var name = $("#name").val();
var address = $("#address").val();
$.post(url, {name: Name, address: Address}, function(data)
{
$("#msg").html(data);
})
})
</script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
@using (Html.BeginForm()) {
@Html.ValidationSummary(true)
vikrant
@ Html.LabelFor(model => model.name)
@Html.LabelFor(model => model.name)
@ Html.EditorFor(model => ; model.name)
@ Html.ValidationMessageFor(model => model.name)
@Html.EditorFor(model => model.name)
@Html.ValidationMessageFor(model => model.name)
@ Html.LabelFor(model => model.address)
@Html.LabelFor(model => model.address)
@ Html.EditorFor(model => model.address)
@ Html.ValidationMessageFor(model => model.address)
@Html.EditorFor(model => model.address)
@Html.ValidationMessageFor(model => model.address)
<输入类型=submitvalue =创建/>
@ Html.ActionLink( 返回列表,索引)
@Html.ActionLink("Back to List", "Index")
controll呃
使用System;
使用System.Collections.Generic;
使用System.Linq;
使用System.Web;
使用System.Web.Mvc;
使用System.Data;
使用System。 Data.SqlClient;
使用System.Configuration;
名称空间MvcApplication91.Controllers
{
公共类HomeController:控制器
{
//
// GET:/ Home /
[HttpPost]
公共ActionResult索引(FormCollection formcollection)
{
vikrant bb = new vikrant();
bb.name = formcollection [name];
bb.address = formcollection [address];
hospitalEntities nn = new hospitalEntities();
nn.addemp(bb);
返回RedirectToAction(Index);
}
[HttpGet]
公共ActionResult索引()
{
返回View();
}
}
}
伙计们帮助我,我想在里面打印消息span
controller
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
namespace MvcApplication91.Controllers
{
public class HomeController : Controller
{
//
// GET: /Home/
[HttpPost]
public ActionResult Index( FormCollection formcollection)
{
vikrant bb = new vikrant();
bb.name = formcollection["name"];
bb.address = formcollection["address"];
hospitalEntities nn = new hospitalEntities();
nn.addemp(bb);
return RedirectToAction("Index");
}
[HttpGet]
public ActionResult Index()
{
return View();
}
}
}
guys kindly help me i want to print message inside span
推荐答案
(#Create)。click(function()
{
var url = / Home / Index;
var name =
("#Create").click( function()
{
var url = "/Home/Index";
var name =
(#name)。val();
var address =
("#name").val();
var address =
(#address)。val();
("#address").val();
这篇关于消息未在跨度内打印的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!