Avatar of Arnold Layne
Arnold Layne
Flag for United States of America asked on

How to parse and organize html ajax results with jQuery

I have an html page that uses jQuery to perform $.get calls to an asp.net page. The asp.net page looks up info from the database and returns a snippet of html code to the calling page, with no html tag, body tag....etc, just the specific snippet. I will use the html snippet that the page returns to parse info from it and plot points on a google map.

Here is what my page will currently return. Usually it will return this for more than one user. For every user the database finds, it will return the following html
<ul id="this is filled in with a different id value from database for each user it finds">

Open in new window

There are three other values of each record returned from the database query besides the user id. These are represented in the list items. All 4 values are from the same record, but the ID value is the wrapper or ul part because that is the unique value of the record returned.

The three other values for the list items are Name, Lat, Lng.

How do I access these values and get them into javascript variables for google maps marker plotting?

I don't need to know the plotting part, just the best way to get these values into usable variables by parsing the very simple html snippet that will be returned.

I CAN count on the order in which these li values appear, so things like first-child could work. Or, I could use an id system and add that to the ouput html snippet. I don't know which is best. Looking for a good idea

Avatar of undefined
Last Comment
Rainer Jeschor

8/22/2022 - Mon
Rainer Jeschor

View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Arnold Layne

Hi Rainer. Is there any subject you don't know about? LOL.
Rainer Jeschor

Yup, there are so many:
Linux / Unix, Java, SAP, Oracle, ...
Pretty all that is not directly created/used by any kind of Microsoft technology :-D

Thanks for the points.

Arnold Layne

Well I wouldn't call a good understanding of jQuery to be Microsoft. Thanks again.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
Rainer Jeschor

Well, since SharePoint is using it out-of-the-box :-)

I really like the possibilities of client side scripting - e.g. dependant drop-downs in MOSS 2007 with the "simple" injection of jQuery and the SPServices JS library.

"Easy" to do, less deployment hazzles but the hell to debug ...