首页 新闻 会员 周边

IFrame下js的调用问题急急急急急急急急

0
悬赏园豆:15 [已解决问题] 解决于 2015-03-24 11:17

@model TP.DistribSys.Shop.WebUI.Models.RegisterViewModel
@{
ViewBag.Title = "注册";
}

<html>
<head>
<title>@ViewBag.Title</title>
<script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
<script type="text/javascript">


</script>
</head>

<body>
<h3>经销商注册</h3>
<iframe id="loginiframe" frameborder="0" scrolling="no" style="left:0px; top:0px;" width="500" height="600" marginheight="0" marginwidth="0" src="@ViewBag.reqUrl"></iframe>
</body>
</html>

 

@model TP.DistribSys.Server.APIs.Models.RegisterViewModel
@{
ViewBag.Title = "注册";
Layout = null;
}

<h2>@ViewBag.Title.</h2>

@using (Html.BeginForm("Register", "Account", new { ReturnUrl = ViewBag.ReturnUrl, ClientId = ViewBag.ClientId }, FormMethod.Post, new { @class = "form-horizontal", role = "form", id = "registerform" }))
{
@Html.AntiForgeryToken()
<h4>用户注册</h4>
<hr />
@Html.ValidationSummary("", new { @class = "text-danger" })
<div class="form-group">
@Html.LabelFor(m => m.Email, new { @class = "col-md-2 control-label" })
<div class="col-md-10">
@Html.TextBoxFor(m => m.Email, new { @class = "form-control" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(m => m.Password, new { @class = "col-md-2 control-label" })
<div class="col-md-10">
@Html.PasswordFor(m => m.Password, new { @class = "form-control" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(m => m.ConfirmPassword, new { @class = "col-md-2 control-label" })
<div class="col-md-10">
@Html.PasswordFor(m => m.ConfirmPassword, new { @class = "form-control" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(m => m.Phone, new { @class = "col-md-2 control-label" })
<div class="col-md-10">
@Html.TextBoxFor(m => m.Phone, new { @class = "form-control" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(m => m.Address, new { @class = "col-md-2 control-label" })
<div class="col-md-10">
@Html.TextBoxFor(m => m.Address, new { @class = "form-control" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(m => m.Connact, new { @class = "col-md-2 control-label" })
<div class="col-md-10">
@Html.TextBoxFor(m => m.Connact, new { @class = "form-control" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(m => m.CompanyName, new { @class = "col-md-2 control-label" })
<div class="col-md-10">
@Html.TextBoxFor(m => m.CompanyName, new { @class = "form-control" })
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="button" class="btn btn-default" id="btnRegister" onclick="test()" value="Register" />
</div>
</div>
<script type="text/javascript">
function test() {
var o = $("#registerform").serializeArray();
var clientId = "@ViewBag.ClientId";
var returnUrl = "@ViewBag.ReturnUrl";
alert(returnUrl);
$.ajax({
url: $("#registerform")[0].action,
type: $("#registerform")[0].method,
data: { data: JSON.stringify(o), clientId: clientId, returnUrl: returnUrl },
success: function (result) {
alert("ddddd");
//changeUrl("?ctl=Mark/GoodPointRule&act=Index");
},
error: function (result) {

}
});
}
</script>

}

@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}

 这是两个域名下的页面是跨域名调用的但是是test()的方法一直无法执行求解决方法

MingHao_Hu的主页 MingHao_Hu | 初学一级 | 园豆:8
提问于:2015-03-02 11:11
< >
分享
最佳答案
0

这代码一贴,我凌乱了。

收获园豆:15
幻天芒 | 高人七级 |园豆:37175 | 2015-03-02 14:18

我去,这也行~

幻天芒 | 园豆:37175 (高人七级) | 2015-03-24 12:11
其他回答(1)
0

方法写错了

MingHao_Hu | 园豆:8 (初学一级) | 2015-03-24 11:16
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册