3

here's my code:

var ids = $.map($("#container-1").children(), function(n, i) {
     return n.id;
});

$.ajax({
    type: 'POST',
    url: 'Loader.asmx/Active',
    data: "{'divs':'" + ids + "'}",
    contentType: 'application/json; charset=utf-8',
    dataType: 'json',
    success: function(msg) {}
});

2 Answers 2

1

Javascript;

var ids = $.map($("#container-1").children(), function(n, i) {
     return n.id;
});

$.ajax({
    type: 'POST',
    url: 'Loader.asmx/Active',
    data: { divs: ids.join("|") },
    contentType: 'application/json; charset=utf-8',
    dataType: 'json',
    success: function(msg) {}
});

in C#:

string[] arrIds = divs.Split('|');
Sign up to request clarification or add additional context in comments.

Comments

0

I wouldn't think you'd need to render your data as a string.

Wouldn't this work?

data: { divs: ids },

Assuming that ids is a JavaScript string array, that is.

Comments

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.