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 7823173
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T08:09:16+00:00 2026-06-02T08:09:16+00:00

I have a modal dialog in MVC3 where im passing a parameter to the

  • 0

I have a modal dialog in MVC3 where im passing a parameter to the controller like this:

$("#SelectedCSIDivisionCodes").live("click", function () {
        var ID = $(this).val();

        $.ajax({
            type: "GET",
            url: '@Url.Action("GetCSICodes", "CSICodes")',
            data: { divisionID: ID },
            dataType: "json",
            error: function (xhr, status, error) {
                alert(xhr);
                alert(status);
                alert(error);
                // you may need to handle me if the json is invalid
                // this is the ajax object
            },
            success: function (json) {
                alert("Data Returned: " + json);
            }
        });

        //            $.getJSON(, { divisionID: ID }, function (data) {
        //                alert(data);
        //            });

    });

And I’m receiving the parameter like this:

   [AcceptVerbs(HttpVerbs.Get)]
    public JsonResult GetCSICodes(string divisionID)
    {
        int ID = Convert.ToInt32(divisionID);
        var csiCodes = (from c in EFProject.CSICode
                        where c.DivisionID == ID
                        select c).OrderBy(x => x.CSICodeID);

        List<SelectListItem> codes = new List<SelectListItem>();

        foreach (var code in csiCodes)
        {
            codes.Add(new SelectListItem { Value = code.CSICodeID.ToString(), Text = code.Code + " " + code.Name });

        }

        return Json(codes.AsEnumerable(), JsonRequestBehavior.AllowGet);
    }

The ajax call works fine but its not detecting the parameter value in the controller. In other words, I’m getting null in the variable divisionID only in the controller. I used firefox to see if im setting a value and it seems that it is doing it because it returns this URL:
GET http://localhost:1925/CSICodes/GetCSICodes?divisionID%5B%5D=2 [HTTP/1.1 200 OK 95690ms]

Any ideas of what could be wrong?

  • 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-06-02T08:09:17+00:00Added an answer on June 2, 2026 at 8:09 am

    Your Action is expecting a parameter of type string, but its getting a parameter of an array type.

    Url should end divisionID=2, instead it’s ending divisionID[]=2 (an array with 1 value of 2).

    In certain circumstances, it’s possible for the val() function to return an array. See http://api.jquery.com/val/ for details.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following modal dialog click function $(#foo).click(function(){$(#bar).dialog({ width: 400, modal: true, resizable:
I have a modal dialog that is created with the following: procedure TFormCompose.createParams(var Params:
I have a modal dialog plugin written in jquery, that binds to the click
I have a modal dialog in main page, then I add jPlayer to this
I have a modal dialog that I would like to implement a right mouse
I have a Modal Dialog: function ShowPopup() { window.showModalDialog('dialog.aspx', null, 'status:no;dialogWidth:950px;dialogHeight:150 px'); } Then
I have this extremely basic jQuery UI Modal Dialog that I wrote for testing
I have a modal dialog which opens on click of Edit button of my
When I have only one modal dialog It works in Safari too. In this
I have the following modal dialog: $(document).ready(function() { $( #addLocation ).dialog({ modal: true, height:

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.