skip to Main Content

Array is empty when it is accepted by API – Javascript

I have FormData object to which I set an array of integers. document.querySelectorAll("input[name="genre"]:checked").forEach((e)=> genres.push(+e.value)); console.log(typeof(genres[0])); //number if (genres.length > 0) { formData.set("genreFilters", JSON.stringify(genres)); } I am sending this FormData object by fetch() to my ASP.NET API fetch("/list", { method: "POST",…

VIEW QUESTION

How to get ObjectId instead of Timestamp and other information in a List field when querying MongoDB with ASP.NET Core Web API?

My mongodb user collection is of following schema: { _id: ObjectId("6420eb68cd0df40a33b0ead7"), FirstName: 'Ashutosh', LastName: 'Garg', Email: '[email protected]', Password: 'password', Role: 'Tenant', Properties: [ ObjectId("6420eeb8cd0df40a33b0eadb") ] } My User.cs is: using MongoDB.Bson; using MongoDB.Bson.Serialization.Attributes; using MongoDB.Driver; using System.Text.Json.Serialization; namespace webapi.Models {…

VIEW QUESTION

Unable to get input value in Razor Page – Html

Do you know what to put at the asp-route-word, I am not able to find it. This is my code: <form class="d-flex" method="get"> <input class="form-control me-sm-2" type="search" placeholder="Search" id="searchWord" /> <button class="btn btn-secondary my-2 my-sm-0" type="submit" asp-controller="Word" asp-action="Index" asp-route-word="???"> Rechercher…

VIEW QUESTION
Back To Top
Search