Json data\javascript

Hi Guys,
I send json data from my server to the view in MVC project.

Here is the link I send as a json:
dataCell.textCell = "<a onmouseout='HideFlyOut()' ;="" class='theme_color' onmouseover='ShowFlyOut('" + encryptedRowPass + "') href=\documentviewer.aspx?" + encryptedValue + "'<i class='fa fa-paperclip fa-flip-horizontal fa-2x theme_color'></i></a>"

Open in new window



Now in my UI side I'm getting this data which is one row and parse it to json:

 var sendDataRowsToView = JSON.parse(datarows)

Open in new window


Then I"m trying to place this data into a <td> in my dom:

 tableBody.append('<td> + sendDataRowsToView + </td>')

Open in new window



I'm getting the data and all works fine but it doesn't bind it to the dom:

Like I'm expecting to see for exmaple:
<td><a></a></td> which bind all the link from the server, but for some reason I can't see this data in my dom.

what am I doing wrong?
LVL 1
Moti Mashiah.NET DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Julian HansenCommented:
It is not clear what you are doing - when you say

I send json data from my server to the view in MVC project.
How?

Now in my UI side I'm getting this data which is one row and parse it to json:
 var sendDataRowsToView = JSON.parse(datarows)

Open in new window

Where does datarows come from?
tableBody - where is this defined.

Can we see more code.
0
Moti Mashiah.NET DeveloperAuthor Commented:
Sorry, Julian.

I wasn't clear enough, so let me simplify things.

let's say I got data from my server that look like that:

Untitled.png
Now the array contains 3 item in each row so the first row is html that I'm trying to bind into the <td></td> in my table but it doesn't show

Let me know if anything else.
0
Julian HansenCommented:
let's say I got data from my server that look like that:
But how are you getting the data from the server? Are you making an AJAX request?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Moti Mashiah.NET DeveloperAuthor Commented:
I just call web Api.
The only thing I want to know is why I can't nest the first item which is  HTML like to the td element. It shows empty.
0
Julian HansenCommented:
We are trying to get there - the code for adding it is as you have it so we have to backtrack to where you are getting the data from - so far I have not seen anything that shows where the data is coming from.

I just call web Api.
Can we see where you call that.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Moti Mashiah.NET DeveloperAuthor Commented:
Hi Julian,
I solved the issue the string URL I built on the server side wasn't written right so that is why I couldn't see anything when it comes to JSON data.
I see the data in the array at 0, but still, when I was trying to place it in the HTML tag I didn't see anything as again the URL was broken.
I fixed the URL and now all working fine.

Sorry, but I don't understand why you were trying to figure out from where the data is coming from. As my question was how do I place the data into the dom, in my view, there is no need to know from where the data is coming from, and that is why I didn't emphasize this part. I also sent a screen shot of how my data looks like.

Thank you.
0
Moti Mashiah.NET DeveloperAuthor Commented:
Thank you for help Julian.
0
Julian HansenCommented:
Sorry, but I don't understand why you were trying to figure out from where the data is coming from. As my question was how do I place the data into the dom, in my view, there is no need to know from where the data is coming from, and that is why I didn't emphasize this part

The reason was because your JavaScript code was correct - but it did not appear to be working. Therefore the logical assumption would be that it was because the data was incorrect. It was pointless trying to fix your front end code - as there was nothing wrong with it - to trace the actual problem we would need to go back to the source.

Anyway, I am glad you are sorted out.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET MVC

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.