The following script is suppossed to return for me the requests booked and append the data I got through json to html.
function readUsers() {
//display ajax loader animation
$( '#ajaxLoadAni' ).fadeIn( 'slow' );
$.ajax({
url: 'user_transactions/get_request',
dataType: 'json',
success: function( response ) {
alert(response)
for( var i in response ) {
response[ i ].updateLink = updateUrl + '/' + response[ i ].id;
response[ i ].deleteLink = delUrl + '/' + response[ i ].id;
}
//clear old rows
$( '#records' ).html( '' );
//append new rows
$( '#readTemplate' ).render( response ).appendTo( "#records" );
//hide ajax loader animation here...
$( '#ajaxLoadAni' ).fadeOut( 'slow' );
}
});
} // end readrequest
I am able to get the data from the url but when I alert the response , it is empty , how can I pass the data through the success function?