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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:38:40+00:00 2026-06-11T10:38:40+00:00

I am working on webapi actually I need to split a string here I

  • 0

I am working on webapi actually I need to split a string here I am getting data from controlers from data I had separated data like Menus and subMenus.

Like I am getting data

  MenuName:  "Home" "product" "setting" "orders" "contact " "Profile"

  SubMenus for Product: 
                       "viewProduct,Addproduct,searchProduct";

Here I need to split the submenus but the menus are not splitted. I don’t know what’s wrong.

Here is my code:

var Url = "/api/MenuItem";
(function($) {
    $.buildMenu = function(MenuId, CurrentPage) {
        $.getJSON(Url, function(data) {
            alert(data);
            var item = data;
            $.each(data, function(k, v) {
                var MenuItems = [];
                MenuItems = v.MenuName;
                alert(MenuItems);

                var subitems = [];
                subitems = v.SubMenUs;
                alert(subitems);

                var spltting = [];
                var splitteditems = [];
                spltting = subitems[0];
                splitteditems = spltting.split(',');
                alert(spltting.count());
                alert(spltting.toString());
                var count = new Array();
                for (var n = 0; n < splitteditems.length; n++) {
                    count.push(parseInt(splitteditems[n]));
                }
            });
            alert(item.toString());
            $('.' + MenuId).append("<ul>");

            for (var i = 0; i < item.length; i++) {
                if (CurrentPage == item[i].MenuName)
                    $('.' + MenuId).append("<li><a class='main_menu_active'>" +
                        item[i].MenuName + "</a></li>"
                    );
                else
                    $('.' + MenuId).append("<li> " +
                        item[i].MenuName + "</li>"
                    );
            }
        });
    }
})(jQuery);​

I need to split the subMenus and need to append to nested list.

  • 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-11T10:38:42+00:00Added an answer on June 11, 2026 at 10:38 am

    jQuery is JavaScript, so this can be accomplished using the JavaScript String.split(",") method.

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

Sidebar

Related Questions

I am working on webapi . I need to get sub-Menus. I am getting
I need some help from some linux gurus. I am working on a webapp
I am working on this WebAPI project and I need to create unit tests
I'm working on a .net webAPI project where we are using dependency injection (StructureMap
I am working toward a small webapp that I would like to have a
I'm currently running a working Spring + Apache Tiles webapp. I need to show
I am working on a webapp that interacts with data via XML-RPC rather than
I am trying to upload video from the iPhone application using FBConnect. Actually I
I am working with the WebAPI in the new MVC 4 Beta. I came
I'm working on a web service using ASP.NET MVC's new WebAPI that will serve

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.