Ajax Error

Ajax Error

stokesystokesy Posts: 3Questions: 1Answers: 0
edited May 2015 in Free community support

Hi,

I am getting the error requested unknown parameter '0' for row 0 when trying to make an ajax call and can't work out for the life of me what it is failing with.

The data returned from the server is:

[{"VillageName":"Test1"},{"VillageName":"Test2"}]

My Code is:

$('#clanMembers').dataTable({
ajax: {
url:"@Url.Action("GetUndecidedClanMembers")",
data: function (d) {
d.clanName = $('#ClanName').val();
d.proposedWarMatchupId = @Model.ProposedWarMatchupId;
},
dataSrc: function (json) {
for ( var i=0, ien=json.length ; i<ien ; i++ ) {
alert(json[i].VillageName);
}
return json;
},
columns: [
{data: "VillageName"}
]
}
});

Any hints on what I am doing wrong?

Answers

  • mRendermRender Posts: 151Questions: 26Answers: 13
    edited May 2015

    It's much easier to read your code if you use ````` before and after your code. The formatting is located below the comment box. Just FYI.

  • stokesystokesy Posts: 3Questions: 1Answers: 0

    Yep just getting to grips with that :)

  • mRendermRender Posts: 151Questions: 26Answers: 13

    Do you have a website that we can look at your code? Some form of test site or jfiddle?

  • stokesystokesy Posts: 3Questions: 1Answers: 0

    Not yet this is all run locally at the moment.

This discussion has been closed.