1
I need to return to ajax a json, or rather several json, being city,neighborhood,state,parents, each being a json in the same method, however as not possible to make several return put the list of obj above in a list of list.
List < List<String> > final = new List < List<String> >();
final.Add(cidade);
final.Add(bairro);
final.Add(estado);
final.Add(pais);
just below return the json from the final list
return Json(final, JsonRequestBehavior.AllowGet);
however when I will display the data in ajax, when accessing the given position[1] or 2 ..., it takes as an entire list and not as a json, I think it returned the json only the positions 0,1,2... and not what has inside it, how to do to return this data as json
<script>
$(document).ready(function () {
cidade.change(function () {
$(function () {
$('#loading').html('<img
$.ajax({
dataType: "json",
type: "GET",
url: "GetDados",
data: { Cidade: cidade.val() },
success: function (dados)
$(dados).each(function (i) {
alert(dados[1]);
});
}
});
});
});
})
</script>
Show the java scrip you are using to view?
– Lucas Ost