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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:24:29+00:00 2026-06-13T22:24:29+00:00

Hi all I have an ajax which has to post data to my controller

  • 0

Hi all I have an ajax which has to post data to my controller action method,but the post function is not firing it does not hit my Action Method, can any one tell me where I am doing wrong, function save menu I call on onclick function of my button,every thing is going good it’s going the function savemenu and parsetree but my ajax method is not firing:

         function savemenu() {
        var columns = $("#columnholder > div").length;
        $("#columnholder > div").each(function (data) {
            var divid = $(this).attr("id");
            parseTree(divid);
        });
    }
    function parseTree(ul) {
        var brand = "";
        var parent;
        alert(ul);
        $("#" + ul).find("ol").each(function (event, ui) {                
            $("#" + ul).find("li").each(function () {
                parent = $(this).attr("parent");
                if ($(this).children("span").length) {
                    brand = brand + $(this).children("span").html() + '~' + $(this).children("span").attr('id') + "=>" + parent + '|';                       
                    alert(brand);
                }                    
            });
            return false;
        });           
        var postdata = JSON.stringify(brand);            
        var MenuBuilderURL = '@Url.Action("MenuDrag","MenuBuilder")';
        alert(MenuBuilderURL);
        $.ajax({
            type: "POST",
            url: "/MenuBuilder/MenuDrag/",
            dataType: "json",
            data: JSON.stringify(brand),
            contentType: 'application/json; charset=utf-8',
            success: function (data) {
                alert(data.Result);
            },                
            traditional: true
        });
    }

here is my controller action method

    public ActionResult MenuDrag()
    {
        return View();
    }
    [AcceptVerbs(HttpVerbs.Post)]
    public ActionResult MenuDrag(List<String> data)
    {
        return View();
    }

can any one help me out here please

  • 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-13T22:24:30+00:00Added an answer on June 13, 2026 at 10:24 pm

    As you said the ajax call is hiting your method,now if you want to post your string to the action

    replace

        var postdata = JSON.stringify(brand); 
    

    with

       var postdata = {};
            postdata.menustring = brand;
    

    and in your ajax post method

        $.ajax({
                url: 'yoururl',
                type: "POST",
                dataType: "json",
                data: JSON.stringify(postdata),
                contentType: 'application/json; charset=utf-8',
                success: function (data) {
                    alert(data.Result);
                },
                traditional: true
            });
    

    hope it will helps you

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

Sidebar

Related Questions

I have a form[method=get] which has a number of checkboxes all have the same
Hey guys I have an ajax jquery function that receives data from a php
I have a main view which has master layout contains all javascripts, ie jQuery
I Have a page which has comments left by users, each post has has
I have this AJAX submission form written with the jQuery validation plugin. It all
I used to have a simple ajax that helped me take all items from
I have a strange error where my jquery ajax request doesn't submit all the
I have three classes that all have a static function called 'create'. I would
I have 50 newsletters which all have different email accouts, hex colour codes and
Is there any provisions in rails that would allow all AJAX POST requests from

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.