0

My JSON Data

{"menu": {
  "id": "file",
  "value": "File",
  "popup": {
    "menuitem": [
      {"value": "New", "onclick": "CreateNewDoc()"},
      {"value": "Open", "onclick": "OpenDoc()"},
      {"value": "Close", "onclick": "CloseDoc()"}
    ]
  }
}}

jQuery code:

$(document).ready(function() {
            $("#Button1").click(function() {    
                var asd = "test";    
                $.get("CallBack.Aspx", { asd: asd }, function(data) {    
                    $.each(data, function() {    
                    })
                })
            })
        })

I need menuitem in values how to make ?

"menuitem": [
      { "value": "New", "onclick": "CreateNewDoc()" } ]

1 Answer 1

1

$.getJSON() fits probably better.

After that,

$.each(data.menu.popup.menuitem, function(i, v) {
    //Your code here
});
Sign up to request clarification or add additional context in comments.

1 Comment

@jAndy Thank you... i can make

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.