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

  • Home
  • SEARCH
  • 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 7802627
In Process

The Archive Base Latest Questions

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

I am trying to wire up and change event jQuery handler for a dropdown

  • 0

I am trying to wire up and change event jQuery handler for a dropdown list I have to populate a div “payment” with html returned from my controller action as soon as user changes a value in the dropdown.

Here is what I have so far and I have no idea why it’s not working or on how to chase this further. No errors or response from changing the dropdown value. Any help very much appreciated!

cshtml:

<script type="text/javascript">
$(document).ready(function () {
    $("#PaymentType").change(function () {
        var selection = $("#PaymentType").val();
        var dataToSend = {
            paymentType: selection
        };

        $.ajax({
            url: "Order/PaymentChanged",
            type: "GET",
            data: dataToSend,
            success: function (data) {
                $("#payment").text("server returned:" + data.agent);
            }
        });
    });
});
</script>

@using (Html.BeginForm())
{
   <div id = "payment">
   <br />
   @Html.Label("Select payment method")
   <br />
   <select id="PaymentType" name="PaymentType">
     <option value="CreditCard">Credit Card</option>
     <option value="Cash">Cash</option>
     <option value="Check">Check</option>
   </select>
   </div>
 }

OrderController.cs

    public JsonResult PaymentChanged(string paymentType)
    {
        return Json(new { agent = "sample html" }, JsonRequestBehavior.AllowGet);
    }

Standard, largely unchanged _Layout.cshtml file with all jQuery src including src=”/Scripts/jquery-1.5.1.min.js”

  • 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-02T01:19:10+00:00Added an answer on June 2, 2026 at 1:19 am

    Code looks fine to me so I’ll answer “how to chase this further”

    • Use Chrome’s debugger or Firebug to see the status of your XHR.
    • Run your MVC app in Debug mode (from Visual Studio) and put a break point inside your controller to see if it’s actually being called and if paymentType is being sent properly (the former is more likely given your code looks fine).
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to wire up a CheckBox to handle an event when check/unchecked. If
I'm trying to wire up Windsor 3.0 to inject connection strings from my web.config
Trying to get comfortable with jQuery and I have encountered some sample code that
I am trying to wire up a new event, but for some reason Changed
I am trying to interface a 4-wire resistive touchscreen to a PIC24FJ256 from Microchip.
I am trying to access an image that is passed into an event handler
I'm trying to render an html table using underscore template engine. First I have
Trying to get parameters from a PUT request using HttpServlet#doPut: public void doPut(HttpServletRequest request,
Trying to parse an HTML document and extract some elements (any links to text
I'm trying to wire up Spring Data JPA objects manually so that I can

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.