TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Marius Vasile
594
1.9k
144.7k
asp.net core send two parameters to json procedure
Mar 17 2021 1:20 PM
I have a tabulated view with data provided from a json. I send one parameter for query and I want to send two parameters. How do I do that?
<ul
class
=
"nav nav-tabs"
role=
"tablist"
id=
"myTab"
>
@{
int
i = 0;
foreach (var item in Model.WOPlannerL.OrderBy(s => s.WONumberS))
{
if
(i == 0)
{
<li
class
=
"nav-item"
>
<a
class
=
"nav-link active"
data-toggle=
"tab"
href=
"url/@item.WOMainID"
data-Id=
"@item.WOMainID"
data-target=
"#@item.WOMainID"
>@item.WONumber - @item.WONumberS</a>
</li>
}
else
{
<li
class
=
"nav-item"
>
<a
class
=
"nav-link"
data-toggle=
"tab"
href=
"url/@item.WOMainID"
data-Id=
"@item.WOMainID"
data-target=
"#@item.WOMainID"
>@item.WONumber - @item.WONumberS</a>
</li>
}
i++;
}
}
</ul>
public
async Task<JsonResult> OnGetCraftAsync(string id)
{
var woplanner = await _context.WOPlanners.FirstAsync(s => s.WOMainID == id);
return
new
JsonResult(woplanner);
}
<script>
$(function () {
$(
".nav-link"
).on(
"click"
, function () {
var categoryId = $(
this
).attr(
"data-Id"
);
$.getJSON(`?handler=Craft&id=${categoryId}`, (data) => {
$(
"#planner"
).html(data.planner);
$(
"#activity"
).html(data.activity);
$(
"#parts"
).html(data.parts);
$(
"#partsA"
).html(data.partsAvailable);
$(
"#tools"
).html(data.tools);
$(
"#toolsA"
).html(data.toolsAvailable);
$(
"#expertise"
).html(data.expertise);
$(
"#expertiseA"
).html(data.expertiseAvailable);
$(
"#sops"
).html(data.sops);
$(
"#sopsA"
).html(data.sopsAvailable);
$(
"#costs"
).html(data.costs);
$(
"#craft"
).html(data.craft);
});
});
});
</script>
Reply
Answers (
6
)
WebApi- The remote server returned an error: (405) Method Not Allowed.
How to disable buttons in webgrid after saving data with jquery