Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 821337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T02:37:26+00:00 2026-05-15T02:37:26+00:00

With this script I get data from JsonResult (GetDevicesTable) and put them to table

  • 0

With this script I get data from JsonResult (GetDevicesTable) and put them to table ( id=”OrderDevices”)

 <script type="text/javascript">

$(document).ready(function() {

    $("#getDevices a").click(function() {
        var Id = $(this).attr("rel");
        var rowToMove = $(this).closest("tr");
        $.post("/ImportXML/GetDevicesTable", { Id: Id }, function(data) {
        if (data.success) {
            //remove row
            rowToMove.fadeOut(function() { $(this).remove() });
            //add row to other table
            $("#OrderDevices").append("<tr><td>"+ data.DeviceId+ "</td><td>" + data.Id+  "</td><td>" + data.OrderId +  "</td></tr>");                    
            } else {
                alert(data.ErrorMsg);
            }
        }, "json");
    });

});

   <% using (Html.BeginForm()) {%>
   <table id="OrderDevices" class="data-table">
   <tr>

        <th>
            DeviceId
        </th>
        <th>
            Id
        </th>
        <th>
            OrderId
        </th>
    </tr>
   </table>
         <p>
            <input type="submit" value="Submit" />
        </p>
 <% } %>

When click on Submit I need something like this:

    $(document).ready(function() {

    $("#submit").click(function() {
        var Id = $(this).attr("rel");
        var DeviceId = $(this).attr(???);
        var OrderId = $(this).attr(???);
        var rowToMove = $(this).closest("tr");
        $.post("/ImportXML/DevicesActions", { Id: Id, DeviceId:DeviceId, OrderId:OrderId }, function(data) {

        }, "json");
    });
});

I have problem with this script because do not know how post data to this JsonResult:

    public JsonResult DevicesActions(int Id,int DeviceId,int OrderId)
    {
     orderdevice ord = new orderdevice();
            ord.Id = Id;
            ord.OrderId = DeviceId;
            ord.DeviceId = OrderId;

            DBEntities.AddToorderdevice(ord);
            DBEntities.SaveChanges();
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T02:37:27+00:00Added an answer on May 15, 2026 at 2:37 am

    In order to get all the ids, deviceIds and orderIds from the table you will need to modify the action signature so that it can accept arrays:

    public ActionResult DevicesActions(int[] ids, int[] deviceIds, int[] orderIds)
    {
        ...
    }
    

    Now that you have this in place you can send the AJAX query:

    var deviceIds = $('#OrderDevices tr td:first-child').map(getValue);
    var ids = $('#OrderDevices tr td:nth-child(2)').map(getValue);
    var orderIds = $('#OrderDevices tr td:nth-child(3)').map(getValue);
    $.post(
        '/ImportXML/DevicesActions', 
        {
            deviceIds: deviceIds,
            ids: ids,
            orderIds: orderIds
        }, 
        function(json) {
            // success
        }
    );
    

    and the getValue function used to map:

    function getValue() {
        return parseInt($(this).text());
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have this code for get data from textfield: <script type=text/javascript> var mod=document.getElementById(mod).value; ajax(mod);
hey guys, i manage to get this script working to pull data from my
I am currently using this script to get new data every second from record_count.php
I tried to use this script pdfmeat to get data about papers from google
I use this script: $(document).ready(function() { $page = jQuery.url.attr(file); alert(page); }); but I get
My jQuery code (using ajax) request's data from a local php script (pgiproxy.php). This
In this script, I'm fetching a load of data from a MySQL aray, and
I am writing a script in PHP to get data from the twitter API,
I have javascript function mixed with ASP MVC Razor that get data from database
I have this following view which I get data from a model and thereafter

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.