I have code below that does work. It makes the .ajax call to my php file, retrieves the array of data as required.
However, when I start looping through the array, I am attempting to dynamically create DOM elements within an existing table. At the point of these function calls, I get the error "undefined functions", note that that commented out alerts DO work, so I know that data is being returned, and the loop IS being entered. I just cannot figure out why my syntax to create the dom elements and attributes is not working.
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"> </script>
<script type="text/javascript">
$.ajaxSetup({
cache: false
});
$(document).ready(
function(){
$.ajax({
url: "PHPLibrary/selectMemberResults.php",
type: "POST",
dataType: "json",
success: function (data) {
//alert("1 Total number of rows of data >" + data.length + "<");
for (var j = 0; j < data[i].length; j++) {
//alert("2 Total number of rows of data >" + data[i].length + "<");
$memName = data[i][0];
$busName = data[i][1];
//alert($memName);
//alert($busName);
(function ($) {
$('tr').attr({width:"100%",id:"row"}).appendto('#memberResults');
$('td').text($memName).appendto("row");
$('tr').attr({width:"100%",id:"row"}).appendto('#memberResults');
$('td').text($busName).appendto("row");
}(jQuery));
}
});
});
</script>
One final note, I've gone through and checked that all curly braces and brackets have matching pairs, in the correct order, as do all of the parenthesis which are terminated with a semicolon (;).
Any thoughts or help would be greatly appreciated.
Thanks!!!!