Hi All,
I'm working on a proof a concept and some how I cannot get the
following script to work:
$.each(data.DATA, function(i){
$('#result').append('<li>' + data.DATA[i][0] + '</li>');
});
The error I get is: " G is undefined". I have tried different things
without success,
$("#result").empty().append(data); works OK.
This is the whole page :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript">
$(function (){
$('#save').click (function (){
$.ajax({
type: 'post',
url:
'cfcs/tjq.cfc?method=user&returnFormat=json',
data: $("form").serialize(),
success: function(data){
//$("#result").empty().append(data);
$.each(data.DATA,
function(i){
$('#result').append('<li>' + data.DATA[i][0] + '</li>');
});
}
});
});
});
</script>
</head>
<body>
<form action="" method="" accept-charset="utf-8">
<label for="first">First:</label>
<input id="first" name="first" type="text">
<label for="last">Last:</label>
<input id="last" name="last" type="text">
<label for="age">Age:</label>
<input id="age" name="age" type="text">
<label for="buttons"> </label>
<input id="save" value="Save" type="button">
</form>
<div id="result"></div>
</body>
</html>
the data returned by the ajax call is:
{"COLUMNS":["ID","NAME"],"DATA":[[6,"Me"],[7,"Choi"],[12,"Peter"],[13,"Johnny"],[14,"Mike"],[17,"Paul"],[24,"Bill
J"],[29,"Test"],[39,"Tech1"],[47,"Kal"],[51,"Mara"],[83,"merry"],[84,"Salesman"],[93,"Marry"],[129,"Paulina"],[156,"Bellan"],[161,"Lynn"],[162,"Vic"],[163,"Jeremy"],[192,"Dinad"],[211,"Jerry"],[212,"Sal"],[213,"SQA"],[215,"SLoc"],[319,"Mikeee"],[375,"Barry"],[382,"Debra"],[386,"Consum"],[444,"Sales1"],[485,"New
User"],[542,"Pinky"],[566,"Cristina"],[591,"TestNA"],[599,"Salem"],[706,"Alex21"],[732,"Emil"],[805,"Justin"]]}
Thx
Victor
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know
on the House of Fusion mailing lists
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:326517
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4