Project

General

Profile

Bug #434

Can you output a HTML table in PHP by using AJAX?

Added by Bradley Nichols over 1 year ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
05/29/2021
Due date:
% Done:

0%

Estimated time:

Description

By using AJAX, the objective is to grab "table" information through an external class that is PHP.

AJAX Request

<script>

function fetch_select(val){
$.ajax({
url: '../assets/includes/class_finder.php',
type: 'post',
data: {option:val},
dataType: 'html',
success:function(result){
$("#result").html(result);
}
});
}

</script>
PHP File (class_finder.php)

$varValue1 = "Value 1";
$varValue2 = "Value 2";
echo "&lt;tr&gt;&lt;td&gt;&lt;div class='team'&gt;$varValue1&lt;/div&gt;&lt;/td&gt;
&lt;td&gt;
&lt;div class='text-center'&gt;
&lt;p class='text-dark' style='padding-top:15px;'&gt;$varValue2&lt;/p&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;";

?>
HTML Result: HTML Result from AJAX Request
Great Lakes Student Loans
What can be changed to have an output of table data in HTML through AJAX?

#1

Updated by Kentaro Hayashi about 1 year ago

  • Status changed from New to Closed

Also available in: Atom PDF