Click here to Skip to main content
15,901,797 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi i am trying to bind array value to my div but its not working the array get value but it dont display the value in the div

C#
function successHandler(data) {

        var jsonObject = JSON.parse(data.body);
        var dataArr = $.makeArray(jsonObject.d.results);
        var resultArr = $.map(dataArr, function (item) {

            return { label: item.Title, value: item.Url };


        });

        var resultDisplay = document.getElementById("result");
        resultDisplay = resultArr;

        

}


HTML
<div id="result"></div>
Posted
Comments
[no name] 13-Jan-15 2:35am    
You can simply display array in your div

$("#result").text(resultArr.join(","));
Kurac1 13-Jan-15 2:41am    
it only displays [object Object] then and not the text value

1 solution

Make following changes in the function
JavaScript
var resultDisplay = document.getElementById("result");
resultDisplay.innerHtml = resultArr.join(",");

Hope, it resolves your problem. If not, please let me know :)
 
Share this answer
 
v2
Comments
Kurac1 13-Jan-15 2:39am    
I doesnt display

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900