Sending information between JavaScript and Web Services using AJAX
Posted
by
COB-CSU-AM
on Stack Overflow
See other posts from Stack Overflow
or by COB-CSU-AM
Published on 2011-06-22T16:30:45Z
Indexed on
2011/06/23
16:22 UTC
Read the original article
Hit count: 204
Alright so I'm using Microsoft's Web Services and AJAX to get information from a SQL database for use with java script on the client side. And I'm wondering what the best method is. Before I started working on the project, the web services were setup to return a C# List filled with some objects. Those objects variables (ints, strings, etc.) contain the data I want to use. Of course, java script can't do much with this, to the best of my knowledge.
I then modified the web service to return a 2D Array, but java script got confused, and to the best of my knowledge can't handle 2D array's returned from C#. I then tried to use a regular array, but then a found the length property of an array in JS doesn't carry over, so I couldn't preform a for loop through all the items, because there wasn't anyway of knowing how many elements there were.
The only other thing I can thing of is returning a string with special char's to separate the data, but this seems way too convoluted. Any suggestions? Thanks in advance!
© Stack Overflow or respective owner