I am getting result [object],[object], why I am not getting JSON data? Please correct me.
My jquery is
$.ajax({
type: "GET",
url: "js/dropDown-json.js",
dataType:"json",
contentType: "application/json; charset=utf-8",
success:function(data){
//alert(data.view);
$.each(data.view, function(){
//alert(data.view.entityView[2]);
$("#selectFilter_dropdown ul li").append("<a href='#'>"+ data.view +"</a>");
});
}
HTML is
<div class="dropDown_wrapper">
<div id="selectFilter_dropdown">
<ul>
<li> </li> <!-- Fetching json data -->
</ul>
</div>
JSON is
{
"view" : [
{ "entityView":"None"},
{ "entityView":"Default Entity View"},
{ "entityView":"Doc View 1"},
{ "entityView":"Global Entity View"},
{ "entityView":"My Items View"}
]}
But the output is [object],[object]… may I know where am I wrong ??
Your $.each is wrong:
v is the value of each item in view.