We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback
Essential JS2

Syncfusion jQuery based widgets are no longer in active development. Switch to our pure JavaScript based next generation Essential JS 2 library.

trying to get the value of HTML table row data when i click button in that table row ...

Thread ID:

Created:

Updated:

Platform:

Replies:

145629 Jul 1,2019 07:24 PM UTC Jul 2,2019 08:58 AM UTC jQuery 1
loading
Tags: General
Mike Burgos
Asked On July 1, 2019 07:24 PM UTC

Any help in the right direction, is greatly appreciated, Thank you in advance.
Here's my code to fetch data from MYSQL Database using PHP ---------------
$.getJSON("BeckysCars_load_automobile_data.php", function(data) {
$.each(data, function(index, data) {
//$("#automobile_body_content").append('');
$("#automobile_body_content").append('
');
//$("#automobile_body_content").append('
');
$("#automobile_body_content").append('
');
//$("#automobile_body_content").append('
');
$("#automobile_body_content").append('
');
$("#automobile_body_content").append('
');
$("#automobile_body_content").append('
');
$("#automobile_body_content").append('
');
$("#automobile_body_content").append('
');
$("#automobile_body_content").append('
');
$("#automobile_body_content").append('
');
$("#automobile_body_content").append('
');
$("#automobile_body_content").append('
');
$("#automobile_body_content").append('
');
$("#automobile_body_content").append('
');
//$("#automobile_body_content").append('
'+data.c_logoContent+''+data.c_name+''+data.c_url+''+data.c_email+''+data.c_phonenum+''+data.c_faxnum+''+data.c_address+''+data.c_city+''+data.c_state+''+data.c_zipcode+''+data.c_country+'
');
});
});
------- This is my layout where my data will be displayed in the tbody section -----------

Automobile Businesses

CompanyEmailPhone#Fax#AddressCityStateZipcodeCountryHiringCoupons
-------- When button is clicked in that row, i want to view the data for that row ------------
$(".coupon_button").on('click',function(){
var arrData = [ ];
// loop over each table row (tr)
$("#myAutoTable").each(function(){
var currentRow = $(this);
var col0_value = currentRow.find("td:eq(0)").text();
var col1_value = currentRow.find("td:eq(1)").text();
var col2_value = currentRow.find("td:eq(2)").text();
var col3_value = currentRow.find("td:eq(3)").text();
var col4_value = currentRow.find("td:eq(4)").text();
var obj = { };
obj.col0 = col0_value;
obj.col1 = col1_value;
obj.col2 = col2_value;
obj.col3 = col3_value;
obj.col4 = col4_value;
arrData.push(obj);
});
alert(arrData)
console.log(arrData);
});
----- if i put the "tr" in the #MyAutoTable selector i get this output -------------------
alert output:
[object Object][object Object][object Object][object Object][object Object]
console.log output:
0: {col0: "", col1: "", col2: "", col3: "", col4: ""}
1: {col0: "", col1: "", col2: "", col3: "", col4: ""}
2: {col0: "", col1: "", col2: "", col3: "", col4: ""}
3: {col0: "", col1: "", col2: "", col3: "", col4: ""}
4: {col0: "", col1: "", col2: "", col3: "", col4: ""}
5: {col0: "", col1: "", col2: "", col3: "", col4: ""}
length: 6
----- But if i remove the "tr" from the #MyAutoTable selector i get this output, but every button press gives me the same data ------------------
alert output:
[object Object]
console.log output:
col0: "Becky's Cars"
col1: "me@gmail.com"
col2: "678-789-9000"
col3: "678-789-9001"
col4: "34 West 29th street"
__proto__: Object
length: 1

Vinoth Kumar Sundara Moorthy [Syncfusion]
Replied On July 2, 2019 08:58 AM UTC

Hi Mike,  
 
Good day to you. 
 
We have checked your code and we found that there are no Syncfusion controls used in your code. However, we suggest you refer the following links for your requirement.  
 
   
  
  
We suspect that you need to display some set of data in a table format. If so, you can achieve this with Syncfusion Grid control. Please refer to the following demo and UG links 
 
  
  
Could you please check the above details and get back to us if you need further assistance to proceed with Syncfusion controls? 
 
Regards, 
Vinoth Kumar S 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon