Pregunta

I've been trying for about a day now to get this method to work.

I'm trying to use the jQuery .each() function to perform an action for each element in a given array.

The array comes from a .post() request

$(document).ready(function() {
$.post("assets/scripts/chat/load_convos.php",{}, function(data) {

//perform the .each() function

});

})

The array is returned in this format [56,98.24,46] through the php file load_convos.php

This is the PHP file

$get_convos = mysql_query("SELECT status, partner_user_id FROM chat_convos WHERE user_id = '$user_id'");
$following_user_id = '';
$uids = array();
while($row = mysql_fetch_assoc($get_convos)){
    array_push($uids, $row['partner_user_id']);
}
$following_user_id = implode(',', $uids);
echo "[$following_user_id]";

I honestly don't see what I'm doing wrong...

========EDIT==========

This is what I have done so far

$.each(data, function(value) { 
  alert(value); 
});

No hay solución correcta

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top