1 Replies - 2764 Views - Last Post: 09 November 2010 - 12:17 PM

#1 W3bDev  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 42
  • View blog
  • Posts: 379
  • Joined: 15-March 09

JSON Data passing to MVC Method

Posted 08 November 2010 - 02:38 PM

Hello all,

I'm beating my head against the wall on this one, unsure what's going on.

I'm trying to pass an array from my view to a json method of an array of integers, but MVC keeps telling me the array (also tried list) is empty, yet firebug shows the data there.... any help would be wonderful:

            $("#removeUPCs").click(function () {
                var upcArray = new Array();

                upcArray[0] = 123412314;
                upcArray[1] = 123123451;

                $.post("/PO/DeleteUPCs", { UPCs: upcArray },
                function (data) {
                    alert(data.UPCs);
                }, "json");

            });




[AcceptVerbs(HttpVerbs.Post)]
        public virtual JsonResult DeleteUPCs(Int64[] UPCs)
        {
            string upcList = "";

            foreach(Int64 upc in UPCs){
                upcList += upc + ", ";
            }

            return Json(new { Result = upcList });

        }


This post has been edited by W3bDev: 08 November 2010 - 02:38 PM


Is This A Good Question/Topic? 0
  • +

Replies To: JSON Data passing to MVC Method

#2 W3bDev  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 42
  • View blog
  • Posts: 379
  • Joined: 15-March 09

Re: JSON Data passing to MVC Method

Posted 09 November 2010 - 12:17 PM

Continued here
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1