in Education by
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)

1 Answer

0 votes
by
If I understood correctly you have multiple buttons that can be pressed and you want to know witch was pressed. Add this to the onclick event function(){ whateverFunctionYouUsed(this)} Or you can just get the attribute you need before sending it to your function. If you have firefox+firebug use this to see all properties of the object and take what you need: function(){ console.log(this) whateverFunctionYouUsed(this) }

Related questions

0 votes
    while ($row1 = mysql_fetch_array($event1)) { $event = $row1['post']; $timeposted = $row1['date']; ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 13, 2022 in Education by JackTerrance
0 votes
    while ($row1 = mysql_fetch_array($event1)) { $event = $row1['post']; $timeposted = $row1['date']; ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 13, 2022 in Education by JackTerrance
0 votes
    This has probably been asked a lot, and I see a whole bunch of different solutions, some of which ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 26, 2022 in Education by JackTerrance
0 votes
    Is there a way in jquery to my browser is not moved by clicking on a link to the new window, so ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 19, 2022 in Education by JackTerrance
0 votes
    Is there a way in jquery to my browser is not moved by clicking on a link to the new window, so ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 19, 2022 in Education by JackTerrance
0 votes
    c. To copy a formula in Microsoft Excel, you select the cell and drag this symbol that appears on the lower ... 7 computer please help Select the correct answer from above options...
asked Dec 28, 2021 in Education by JackTerrance
0 votes
    Select right statement to insert values in the table CUSTOMERS * a) INSERT VALUES INTO CUSTOMERS . b) INSERT INTO ... NONE OF THE ABOV Select the correct answer from above options...
asked Dec 24, 2021 in Education by JackTerrance
0 votes
    What are the feature selection methods used to select the right variables?...
asked Apr 26, 2021 in Technology by JackTerrance
0 votes
    I have a div and, inside it, an unordered list with several list items that serve as navigation menu ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 7, 2022 in Education by JackTerrance
0 votes
    I want a div containing three images and I'd like the images stacked vertically. I've set the div ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 12, 2022 in Education by JackTerrance
0 votes
    I gave this CSS class to some input fields .searchField { display: inline-block; } This is their ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 20, 2022 in Education by JackTerrance
0 votes
    Wordpress site. I want jquery or php, or any easy solution that will grab div from div id=content ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 17, 2022 in Education by JackTerrance
0 votes
    I'm looking for a macro which can be run to select a consistent range of cells so that I can ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 11, 2022 in Education by JackTerrance
0 votes
0 votes
    If I want to hold a Teams meeting and invite “guests,” what happens if I select that only specific domains ... still able to join the Teams meeting from via a link?...
asked Mar 10, 2021 in Technology by JackTerrance
...