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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:22:56+00:00 2026-05-25T20:22:56+00:00

I have an Ajax call to my controller action looks like this: var m

  • 0

I have an Ajax call to my controller action looks like this:

var m = $.ajax({
        mtype: "GET",
        url: '@Url.Action("GetBrandForValidation")',
        data: { actionparameter: value },
        async: false,
        cache: false
});

As u can see i return actionparametter to my controller and controller have to return either true or false which has to be my “m” value, but i cant get it to work. Any ideas?

Controller Code:

public virtual JsonResult GetBrandForValidation(string actionparameter)
{
    var vendorId = _service.GetVendorIdByUsername(GetUserName());
    bool k;
    var brands = _service.GetBrandsByVendor(vendorId);
    var brand = new BrandsViewModel();
    brand.BrandName = "Opret ny Brand...";
    brands.Add(brand);

    foreach (var brandsViewModel in brands)
    {
        if (brandsViewModel.BrandName == "Intet")
        {
            brandsViewModel.BrandName = "";
        }
    }

    var list = brands.Select(s => s.BrandName);
    if (list.Contains(actionparameter))
    {
        k = true;
    }
    else
        k = false;

    return Json(k,JsonRequestBehavior.AllowGet);
}

And full function code :

var checkBrands = function(value, colname) {  
    var m = $.ajax({
                mtype: "GET",
                url: '@Url.Action("GetBrandForValidation")',
                data: { actionparameter: value },
                async: false,
                cache: false

    });
    if (m == true)
        return [true, ""];
    else
        return [false, "Brand eksistere ikke"];
};

Im quite new and very awfull at javascript, so dont judge hard

  • 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-25T20:22:57+00:00Added an answer on May 25, 2026 at 8:22 pm

    SOLVED

    var checkBrands = function (value, colname) {
    
          var m = $.ajax({
              mtype: "type",
              url: '@Url.Action("GetBrandForValidation")',
              async: false,
              cache: false,
              data: { actionparameter: value }
    
          }).responseText;
    
    
          if (m == 'true'){
              return [true, ""];
          }
          else return [false, "Brand eksistere ikke"];
    
      };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ajax call that looks like this: $.ajax({ url: '@Url.Action(SaveStudy)', type: POST,
i have an ajax call $.ajax({ url: '<%=Url.Action(SaveDetails,Survey) %>', dataType: 'JSON', cache: false, data:
Hei guys i have this JQuery Ajax call from my view and it looks
I have a controller action which looks like so - def upvote @post =
I have two ajax calls. Both are sync. Both call methods from one controller.
I have an ajax call. I put the return value (data) in a variable
So, I have a page that looks like the following: alt text http://img704.imageshack.us/img704/5973/croppercapture3.png This
I am trying to achieve a JQuery AJAX call to a controller action method
I make an ajax request to invoke a controller action like so: Controller: [AsyncTimeout(8000,
I have a controller action that I want to update via a jquery call.

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.