Call view with ajax javascript in ASP.NET MVC
I want to call Action
to open up my Index View
by Ajax Javascript, but it does not load target view. Before I use ajax I called action like this that work properly:
<a class="btn btn-orange" href="@Url.Action("Index", "Booking", new { area = "Portal" })">انتخاب</a>
But I need to call with javascript Ajax and when I transfer that to this :
<a class="btn btn-orange" onclick="Booking(@Json.Encode(item))">انتخاب</a>
I faced this problem that it does not load page.
This is my ajax code:
function Booking(obj) {
var schedulingViewModel = {
};
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
schedulingViewModel[key] = obj[key];
}
}
$.ajax({
url: '/Portal/Booking',
type: 'post',
data: schedulingViewModel,
success: function (data) {
alert('Data: ' + data);
},
error: function (request, error) {
alert("Request: " + JSON.stringify(request));
}
});
}
And this s my BookingController:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Tranship.ViewModel;
namespace Tranship.UI.Areas.Portal.Controllers
{
public class BookingController: Controller
{
[HttpPost]
public ActionResult Index(ScheduleViewModel schedulingViewModel)
{
return View("Index", schedulingViewModel);
}
}
}
This is my view with IEnumerable model that I want to send an Item of that to action:
@model IEnumerable<Tranship.ViewModel.ScheduleViewModel>
<div class="pg-search-form">
@foreach (var item in Model)
{
<div class="list-block main-block f-list-block dashboard-listing booking-listing">
<div class="list-content">
<table class="table table-hover">
<tbody>
<tr>
<td class="dash-list-icon booking-list-date">
<div class="b-date">
<h3>@item.DepartureDay</h3>
<p>@item.DepartureMonth</p>
</div>
</td>
<td class="dash-list-text booking-list-detail">
<h3>@item.Origin به @item.Destination</h3>
<ul class="list-unstyled booking-info">
<li>@item.DepartureDate<span>تاریخ رفت :</span></li>
<li>@item.ArrivalDate<span>تاریخ برگشت :</span></li>
<li>@item.Adult نفر<span>تعداد :</span></li>
</ul>
</td>
<td class="dash-list-btn">
<a class="btn btn-orange" onclick="BookingMethod(@Json.Encode(item))">انتخاب</a>
@*<button type="submit" class="btn btn-orange">انتخاب</button>*@
@*<a class="btn btn-orange" href="@Url.Action("Index", "Booking", new { area = "Portal" })">انتخاب</a>*@
<div id="price">@item.Price تومان</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end list-content -->
</div>
}
<div class="pages">
<ol class="pagination">
<li><a href="#" aria-label="Previous"><span aria-hidden="true"><i class="fa fa-angle-left"></i></span></a></li>
<li class="active"><a href="#">1</a></li>
<li><a href="#">2</a></li>
<li><a href="#">3</a></li>
<li><a href="#">4</a></li>
<li><a href="#" aria-label="Next"><span aria-hidden="true"><i class="fa fa-angle-right"></i></span></a></li>
</ol>
</div>
<!-- end pages -->
</div>
In fact ajax return correct HTML but I couldn't find why it does not redirect to target view.
javascript ajax asp.net-mvc
|
show 3 more comments
I want to call Action
to open up my Index View
by Ajax Javascript, but it does not load target view. Before I use ajax I called action like this that work properly:
<a class="btn btn-orange" href="@Url.Action("Index", "Booking", new { area = "Portal" })">انتخاب</a>
But I need to call with javascript Ajax and when I transfer that to this :
<a class="btn btn-orange" onclick="Booking(@Json.Encode(item))">انتخاب</a>
I faced this problem that it does not load page.
This is my ajax code:
function Booking(obj) {
var schedulingViewModel = {
};
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
schedulingViewModel[key] = obj[key];
}
}
$.ajax({
url: '/Portal/Booking',
type: 'post',
data: schedulingViewModel,
success: function (data) {
alert('Data: ' + data);
},
error: function (request, error) {
alert("Request: " + JSON.stringify(request));
}
});
}
And this s my BookingController:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Tranship.ViewModel;
namespace Tranship.UI.Areas.Portal.Controllers
{
public class BookingController: Controller
{
[HttpPost]
public ActionResult Index(ScheduleViewModel schedulingViewModel)
{
return View("Index", schedulingViewModel);
}
}
}
This is my view with IEnumerable model that I want to send an Item of that to action:
@model IEnumerable<Tranship.ViewModel.ScheduleViewModel>
<div class="pg-search-form">
@foreach (var item in Model)
{
<div class="list-block main-block f-list-block dashboard-listing booking-listing">
<div class="list-content">
<table class="table table-hover">
<tbody>
<tr>
<td class="dash-list-icon booking-list-date">
<div class="b-date">
<h3>@item.DepartureDay</h3>
<p>@item.DepartureMonth</p>
</div>
</td>
<td class="dash-list-text booking-list-detail">
<h3>@item.Origin به @item.Destination</h3>
<ul class="list-unstyled booking-info">
<li>@item.DepartureDate<span>تاریخ رفت :</span></li>
<li>@item.ArrivalDate<span>تاریخ برگشت :</span></li>
<li>@item.Adult نفر<span>تعداد :</span></li>
</ul>
</td>
<td class="dash-list-btn">
<a class="btn btn-orange" onclick="BookingMethod(@Json.Encode(item))">انتخاب</a>
@*<button type="submit" class="btn btn-orange">انتخاب</button>*@
@*<a class="btn btn-orange" href="@Url.Action("Index", "Booking", new { area = "Portal" })">انتخاب</a>*@
<div id="price">@item.Price تومان</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end list-content -->
</div>
}
<div class="pages">
<ol class="pagination">
<li><a href="#" aria-label="Previous"><span aria-hidden="true"><i class="fa fa-angle-left"></i></span></a></li>
<li class="active"><a href="#">1</a></li>
<li><a href="#">2</a></li>
<li><a href="#">3</a></li>
<li><a href="#">4</a></li>
<li><a href="#" aria-label="Next"><span aria-hidden="true"><i class="fa fa-angle-right"></i></span></a></li>
</ol>
</div>
<!-- end pages -->
</div>
In fact ajax return correct HTML but I couldn't find why it does not redirect to target view.
javascript ajax asp.net-mvc
The whole point of ajax is to stay on the same page. Ajax calls cannot redirect. If you want to redirect, then DO NOT use ajax.
– user3559349
Nov 17 '18 at 12:36
what should I do? I need to send my model in the loop. I could not use @HTML.Beginform and submit that
– Sasan K
Nov 17 '18 at 12:38
Why not? What makes you think you need to send my model in the loop? (you don't if you have generated your view correctly)
– user3559349
Nov 17 '18 at 12:40
@ Stephen Muecke- please take a look at my view it is a collection and I want to the item that user click on it
– Sasan K
Nov 17 '18 at 12:43
Could you possibly leave a sample post?
– Sasan K
Nov 17 '18 at 12:44
|
show 3 more comments
I want to call Action
to open up my Index View
by Ajax Javascript, but it does not load target view. Before I use ajax I called action like this that work properly:
<a class="btn btn-orange" href="@Url.Action("Index", "Booking", new { area = "Portal" })">انتخاب</a>
But I need to call with javascript Ajax and when I transfer that to this :
<a class="btn btn-orange" onclick="Booking(@Json.Encode(item))">انتخاب</a>
I faced this problem that it does not load page.
This is my ajax code:
function Booking(obj) {
var schedulingViewModel = {
};
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
schedulingViewModel[key] = obj[key];
}
}
$.ajax({
url: '/Portal/Booking',
type: 'post',
data: schedulingViewModel,
success: function (data) {
alert('Data: ' + data);
},
error: function (request, error) {
alert("Request: " + JSON.stringify(request));
}
});
}
And this s my BookingController:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Tranship.ViewModel;
namespace Tranship.UI.Areas.Portal.Controllers
{
public class BookingController: Controller
{
[HttpPost]
public ActionResult Index(ScheduleViewModel schedulingViewModel)
{
return View("Index", schedulingViewModel);
}
}
}
This is my view with IEnumerable model that I want to send an Item of that to action:
@model IEnumerable<Tranship.ViewModel.ScheduleViewModel>
<div class="pg-search-form">
@foreach (var item in Model)
{
<div class="list-block main-block f-list-block dashboard-listing booking-listing">
<div class="list-content">
<table class="table table-hover">
<tbody>
<tr>
<td class="dash-list-icon booking-list-date">
<div class="b-date">
<h3>@item.DepartureDay</h3>
<p>@item.DepartureMonth</p>
</div>
</td>
<td class="dash-list-text booking-list-detail">
<h3>@item.Origin به @item.Destination</h3>
<ul class="list-unstyled booking-info">
<li>@item.DepartureDate<span>تاریخ رفت :</span></li>
<li>@item.ArrivalDate<span>تاریخ برگشت :</span></li>
<li>@item.Adult نفر<span>تعداد :</span></li>
</ul>
</td>
<td class="dash-list-btn">
<a class="btn btn-orange" onclick="BookingMethod(@Json.Encode(item))">انتخاب</a>
@*<button type="submit" class="btn btn-orange">انتخاب</button>*@
@*<a class="btn btn-orange" href="@Url.Action("Index", "Booking", new { area = "Portal" })">انتخاب</a>*@
<div id="price">@item.Price تومان</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end list-content -->
</div>
}
<div class="pages">
<ol class="pagination">
<li><a href="#" aria-label="Previous"><span aria-hidden="true"><i class="fa fa-angle-left"></i></span></a></li>
<li class="active"><a href="#">1</a></li>
<li><a href="#">2</a></li>
<li><a href="#">3</a></li>
<li><a href="#">4</a></li>
<li><a href="#" aria-label="Next"><span aria-hidden="true"><i class="fa fa-angle-right"></i></span></a></li>
</ol>
</div>
<!-- end pages -->
</div>
In fact ajax return correct HTML but I couldn't find why it does not redirect to target view.
javascript ajax asp.net-mvc
I want to call Action
to open up my Index View
by Ajax Javascript, but it does not load target view. Before I use ajax I called action like this that work properly:
<a class="btn btn-orange" href="@Url.Action("Index", "Booking", new { area = "Portal" })">انتخاب</a>
But I need to call with javascript Ajax and when I transfer that to this :
<a class="btn btn-orange" onclick="Booking(@Json.Encode(item))">انتخاب</a>
I faced this problem that it does not load page.
This is my ajax code:
function Booking(obj) {
var schedulingViewModel = {
};
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
schedulingViewModel[key] = obj[key];
}
}
$.ajax({
url: '/Portal/Booking',
type: 'post',
data: schedulingViewModel,
success: function (data) {
alert('Data: ' + data);
},
error: function (request, error) {
alert("Request: " + JSON.stringify(request));
}
});
}
And this s my BookingController:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Tranship.ViewModel;
namespace Tranship.UI.Areas.Portal.Controllers
{
public class BookingController: Controller
{
[HttpPost]
public ActionResult Index(ScheduleViewModel schedulingViewModel)
{
return View("Index", schedulingViewModel);
}
}
}
This is my view with IEnumerable model that I want to send an Item of that to action:
@model IEnumerable<Tranship.ViewModel.ScheduleViewModel>
<div class="pg-search-form">
@foreach (var item in Model)
{
<div class="list-block main-block f-list-block dashboard-listing booking-listing">
<div class="list-content">
<table class="table table-hover">
<tbody>
<tr>
<td class="dash-list-icon booking-list-date">
<div class="b-date">
<h3>@item.DepartureDay</h3>
<p>@item.DepartureMonth</p>
</div>
</td>
<td class="dash-list-text booking-list-detail">
<h3>@item.Origin به @item.Destination</h3>
<ul class="list-unstyled booking-info">
<li>@item.DepartureDate<span>تاریخ رفت :</span></li>
<li>@item.ArrivalDate<span>تاریخ برگشت :</span></li>
<li>@item.Adult نفر<span>تعداد :</span></li>
</ul>
</td>
<td class="dash-list-btn">
<a class="btn btn-orange" onclick="BookingMethod(@Json.Encode(item))">انتخاب</a>
@*<button type="submit" class="btn btn-orange">انتخاب</button>*@
@*<a class="btn btn-orange" href="@Url.Action("Index", "Booking", new { area = "Portal" })">انتخاب</a>*@
<div id="price">@item.Price تومان</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end list-content -->
</div>
}
<div class="pages">
<ol class="pagination">
<li><a href="#" aria-label="Previous"><span aria-hidden="true"><i class="fa fa-angle-left"></i></span></a></li>
<li class="active"><a href="#">1</a></li>
<li><a href="#">2</a></li>
<li><a href="#">3</a></li>
<li><a href="#">4</a></li>
<li><a href="#" aria-label="Next"><span aria-hidden="true"><i class="fa fa-angle-right"></i></span></a></li>
</ol>
</div>
<!-- end pages -->
</div>
In fact ajax return correct HTML but I couldn't find why it does not redirect to target view.
javascript ajax asp.net-mvc
javascript ajax asp.net-mvc
edited Nov 17 '18 at 12:41
Sasan K
asked Nov 17 '18 at 12:33
Sasan KSasan K
1109
1109
The whole point of ajax is to stay on the same page. Ajax calls cannot redirect. If you want to redirect, then DO NOT use ajax.
– user3559349
Nov 17 '18 at 12:36
what should I do? I need to send my model in the loop. I could not use @HTML.Beginform and submit that
– Sasan K
Nov 17 '18 at 12:38
Why not? What makes you think you need to send my model in the loop? (you don't if you have generated your view correctly)
– user3559349
Nov 17 '18 at 12:40
@ Stephen Muecke- please take a look at my view it is a collection and I want to the item that user click on it
– Sasan K
Nov 17 '18 at 12:43
Could you possibly leave a sample post?
– Sasan K
Nov 17 '18 at 12:44
|
show 3 more comments
The whole point of ajax is to stay on the same page. Ajax calls cannot redirect. If you want to redirect, then DO NOT use ajax.
– user3559349
Nov 17 '18 at 12:36
what should I do? I need to send my model in the loop. I could not use @HTML.Beginform and submit that
– Sasan K
Nov 17 '18 at 12:38
Why not? What makes you think you need to send my model in the loop? (you don't if you have generated your view correctly)
– user3559349
Nov 17 '18 at 12:40
@ Stephen Muecke- please take a look at my view it is a collection and I want to the item that user click on it
– Sasan K
Nov 17 '18 at 12:43
Could you possibly leave a sample post?
– Sasan K
Nov 17 '18 at 12:44
The whole point of ajax is to stay on the same page. Ajax calls cannot redirect. If you want to redirect, then DO NOT use ajax.
– user3559349
Nov 17 '18 at 12:36
The whole point of ajax is to stay on the same page. Ajax calls cannot redirect. If you want to redirect, then DO NOT use ajax.
– user3559349
Nov 17 '18 at 12:36
what should I do? I need to send my model in the loop. I could not use @HTML.Beginform and submit that
– Sasan K
Nov 17 '18 at 12:38
what should I do? I need to send my model in the loop. I could not use @HTML.Beginform and submit that
– Sasan K
Nov 17 '18 at 12:38
Why not? What makes you think you need to send my model in the loop? (you don't if you have generated your view correctly)
– user3559349
Nov 17 '18 at 12:40
Why not? What makes you think you need to send my model in the loop? (you don't if you have generated your view correctly)
– user3559349
Nov 17 '18 at 12:40
@ Stephen Muecke- please take a look at my view it is a collection and I want to the item that user click on it
– Sasan K
Nov 17 '18 at 12:43
@ Stephen Muecke- please take a look at my view it is a collection and I want to the item that user click on it
– Sasan K
Nov 17 '18 at 12:43
Could you possibly leave a sample post?
– Sasan K
Nov 17 '18 at 12:44
Could you possibly leave a sample post?
– Sasan K
Nov 17 '18 at 12:44
|
show 3 more comments
1 Answer
1
active
oldest
votes
window.location()
is used to redirect from one page to another page.
After Successful ajax request write that code.
$.ajax({
url: '/Portal/Booking',
type: 'post',
data: schedulingViewModel,
success: function (data) {
alert('Data: ' + data);
window.location = "/Booking/Index";
},
error: function (request, error) {
alert("Request: " + JSON.stringify(request));
}
});
Thanks, you helped me a lot.
– Sasan K
Nov 21 '18 at 9:31
@Prashant Pimpale - It worked but how can I sent my Model as json with window.location??
– Sasan K
Nov 21 '18 at 9:44
@SasanK You are more than welcome, I'm glad I could help.
– Maviya Qureshi
Nov 21 '18 at 10:50
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53351308%2fcall-view-with-ajax-javascript-in-asp-net-mvc%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
window.location()
is used to redirect from one page to another page.
After Successful ajax request write that code.
$.ajax({
url: '/Portal/Booking',
type: 'post',
data: schedulingViewModel,
success: function (data) {
alert('Data: ' + data);
window.location = "/Booking/Index";
},
error: function (request, error) {
alert("Request: " + JSON.stringify(request));
}
});
Thanks, you helped me a lot.
– Sasan K
Nov 21 '18 at 9:31
@Prashant Pimpale - It worked but how can I sent my Model as json with window.location??
– Sasan K
Nov 21 '18 at 9:44
@SasanK You are more than welcome, I'm glad I could help.
– Maviya Qureshi
Nov 21 '18 at 10:50
add a comment |
window.location()
is used to redirect from one page to another page.
After Successful ajax request write that code.
$.ajax({
url: '/Portal/Booking',
type: 'post',
data: schedulingViewModel,
success: function (data) {
alert('Data: ' + data);
window.location = "/Booking/Index";
},
error: function (request, error) {
alert("Request: " + JSON.stringify(request));
}
});
Thanks, you helped me a lot.
– Sasan K
Nov 21 '18 at 9:31
@Prashant Pimpale - It worked but how can I sent my Model as json with window.location??
– Sasan K
Nov 21 '18 at 9:44
@SasanK You are more than welcome, I'm glad I could help.
– Maviya Qureshi
Nov 21 '18 at 10:50
add a comment |
window.location()
is used to redirect from one page to another page.
After Successful ajax request write that code.
$.ajax({
url: '/Portal/Booking',
type: 'post',
data: schedulingViewModel,
success: function (data) {
alert('Data: ' + data);
window.location = "/Booking/Index";
},
error: function (request, error) {
alert("Request: " + JSON.stringify(request));
}
});
window.location()
is used to redirect from one page to another page.
After Successful ajax request write that code.
$.ajax({
url: '/Portal/Booking',
type: 'post',
data: schedulingViewModel,
success: function (data) {
alert('Data: ' + data);
window.location = "/Booking/Index";
},
error: function (request, error) {
alert("Request: " + JSON.stringify(request));
}
});
edited Nov 21 '18 at 6:54
Prashant Pimpale
3,3323830
3,3323830
answered Nov 21 '18 at 6:47
Maviya QureshiMaviya Qureshi
264
264
Thanks, you helped me a lot.
– Sasan K
Nov 21 '18 at 9:31
@Prashant Pimpale - It worked but how can I sent my Model as json with window.location??
– Sasan K
Nov 21 '18 at 9:44
@SasanK You are more than welcome, I'm glad I could help.
– Maviya Qureshi
Nov 21 '18 at 10:50
add a comment |
Thanks, you helped me a lot.
– Sasan K
Nov 21 '18 at 9:31
@Prashant Pimpale - It worked but how can I sent my Model as json with window.location??
– Sasan K
Nov 21 '18 at 9:44
@SasanK You are more than welcome, I'm glad I could help.
– Maviya Qureshi
Nov 21 '18 at 10:50
Thanks, you helped me a lot.
– Sasan K
Nov 21 '18 at 9:31
Thanks, you helped me a lot.
– Sasan K
Nov 21 '18 at 9:31
@Prashant Pimpale - It worked but how can I sent my Model as json with window.location??
– Sasan K
Nov 21 '18 at 9:44
@Prashant Pimpale - It worked but how can I sent my Model as json with window.location??
– Sasan K
Nov 21 '18 at 9:44
@SasanK You are more than welcome, I'm glad I could help.
– Maviya Qureshi
Nov 21 '18 at 10:50
@SasanK You are more than welcome, I'm glad I could help.
– Maviya Qureshi
Nov 21 '18 at 10:50
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53351308%2fcall-view-with-ajax-javascript-in-asp-net-mvc%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
The whole point of ajax is to stay on the same page. Ajax calls cannot redirect. If you want to redirect, then DO NOT use ajax.
– user3559349
Nov 17 '18 at 12:36
what should I do? I need to send my model in the loop. I could not use @HTML.Beginform and submit that
– Sasan K
Nov 17 '18 at 12:38
Why not? What makes you think you need to send my model in the loop? (you don't if you have generated your view correctly)
– user3559349
Nov 17 '18 at 12:40
@ Stephen Muecke- please take a look at my view it is a collection and I want to the item that user click on it
– Sasan K
Nov 17 '18 at 12:43
Could you possibly leave a sample post?
– Sasan K
Nov 17 '18 at 12:44