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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T04:06:23+00:00 2026-05-15T04:06:23+00:00

I’m trying to call a server-side action in a controller from jQuery: $.ajax({ url:’http://localhost:88/admin/business/11/GetChildBusinessTypes’,

  • 0

I’m trying to call a server-side action in a controller from jQuery:

$.ajax({
            url:'http://localhost:88/admin/business/11/GetChildBusinessTypes',
            data: { parentId: $('#business_parentbusinesstype_id').val() },
            dataType: 'json',
            success: fillChildBusinessTypes,
            error: ajaxError
        });

Here is the controller action:

public string GetChildBusinessTypes(int parentId)
        {
            //get child business types.
            var businessTypes = BusinessTypeRepository.GetChildBusinessTypes(parentId);
            //convert to JSON.
            var serializer = new JavaScriptSerializer();
            return serializer.Serialize(businessTypes);
        }

It’s giving me this error:

MonoRail could not resolve a view engine instance for the template ‘admin\business\GetChildBusinessTypes’ There are two possible reasons: either the template does not exist, or the view engine that handles an specific file extension has not been configured correctly web.config (section monorail, node viewEngines).

It’s clear it’s trying to get the action as if it were a view and erroring out. I tried sending it as a POST instead of a GET but receive the same rror. What do I need to do to get this to work?

Thanks!
Justin

  • 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-15T04:06:23+00:00Added an answer on May 15, 2026 at 4:06 am

    Here’s the answer for others who are looking to call controller actions from jQuery and return JSON…

    Controller Method:

    [return: JSONReturnBinder(Properties = "Id,Name")]
            public BusinessType[] GetChildBusinessTypes(int parentId)
            {
                var businessTypes = BusinessTypeRepository.GetChildBusinessTypes(parentId);
                return businessTypes;
            }
    

    Javascript:

    $(document).ready(function () {
            $('#business_parentbusinesstype_id').change(function () {
                jQuery.ajax({
                    url: "$UrlHelper.For("%{action='$business.site.id/GetChildBusinessTypes'}")",
                    data: { parentId: $('#business_parentbusinesstype_id').val() },
                    dataType: 'json',
                    type: 'GET',
                    success: fillChildBusinessTypes,
                    error: ajaxError
                });
            });
        });
    
        function fillChildBusinessTypes(json) {
            //get business types.
            var businessTypes = eval(json);
            //bind business types to dropdown.
            $("#business_businesstype_id").get(0).options.length = 0;
            $("#business_businesstype_id").get(0).options[0] = new Option("Select a Business Type", "0");
            jQuery.each(businessTypes, function(index, item) {
                $('#business_businesstype_id').get(0).options[$("#business_businesstype_id").get(0).options.length] = new Option(item.Name, item.Id);
            });
            //show child dropdown.
            Show($('#spnChildBusinessTypes'));
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Does anyone know how can I replace this 2 symbol below from the string
I am trying to loop through a bunch of documents I have to put
I have a bunch of posts stored in text files formatted in yaml/textile (from
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
Seemingly simple, but I cannot find anything relevant on the web. What is the

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.