Link to home
Start Free TrialLog in
Avatar of Arnold Layne
Arnold LayneFlag for United States of America

asked on

getting info from class instances on the page

I want to compare the address values that I have in an array, to address values within all tags with a class name of .databaseAddress. If they match, I want to get the next sibling of the databaseAddress class instance, and get it's inner text value for an ID. Then, I want to send a get request out with the ID of the record that needs to be changed gained from the next sibling's inner text  and the order that the .databaseAddress class instance was found. So one query string variable of the get provides the record id of the record that needs to be updated, and the second variable provides a sort order value. So essentially, I want the sort order column in the database to match whatever sort order the page happens to have. I'm very close, but I'm doing something wrong. Here's my code

$.each($(".databaseAddress"), function (x, daddress) {
                $.each(addressesTrim, function (i, address) {
                    if (daddress == address) {
                        var id = $(this).next().text();
                        $.get(encodeURI("sortOrders.aspx?ID=" + id + "&sortOrder=" + x)); 
                    }

                });
            });

Open in new window


ASP.NET generated html
Response.Write("<div class='directionsAddress noDisplay'>" + directionsAddress + "</div>");
Response.Write("<div class='databaseAddress noDisplay'>" + databaseAddress + "</div>");

Open in new window


addressTrim is an array that is set earlier in the code, and I can see it contains the values I expect, so that's not the problem. The problem is getting the actual address value contained within each .databaseAddress, and going to it's next sibling and getting it's inner text for the ID. I tried daddress.text(), but that's not going to work. Seems like there is one small detail that I am missing, and any help would be greatly appreciated.
ASKER CERTIFIED SOLUTION
Avatar of hielo
hielo
Flag of Wallis and Futuna image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial