while ($row1 = mysql_fetch_array($event1))
{
$event = $row1['post'];
$timeposted = $row1['date'];
$eventmemdata = mysql_query("SELECT id,firstname FROM users WHERE id = '$id' LIMIT 1");
while($rowaa = mysql_fetch_array($eventmemdata))
{
$name = $rowaa['firstname'];
$eventlist = "$event
$name";
}
echo "
$timeposted
$eventlist
lol
";
echo "
";
}
?>
I need to determine in which div the button was clicked in, this is the ajax function, i need to echo num in the php tags however i only want it to be echoed in the class/post where the button was clicked as it is in a while loop and there are many replicas of the button.
var num = 1;
function ajax_post(){
// Create our XMLHttpRequest object
var hr = new XMLHttpRequest();
// Create some variables we need to send to our PHP file
var url = "javas.php";
hr.open("POST", url, true);
// Set content type header information for sending url encoded variables in the request
hr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
// Access the onreadystatechange event for the XMLHttpRequest object
hr.onreadystatechange = function() {
if(hr.readyState == 4 && hr.status == 200) {
var return_data = hr.responseText;
document.getElementById("status").innerHTML = return_data;
}
}
// Send the data to PHP now... and wait for response to update the status div
hr.send("num=" + (++num)); // Actually execute the request
document.getElementById("status").innerHTML = "processing...";
}
Then how can I display the information/data in that specific Div in which the button was clicked. As i have it now the echoing takes place in the first class it picks up! Much appreciated, thanks!
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)