Guest User

Untitled

a guest
Feb 10th, 2018
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. function DataRetrieval(TableName, DataSet){
  2. var conn = mysql.createConnection({
  3. host: 'localhost',
  4. user: 'root',
  5. password: '',
  6. database: 'fmis'
  7. });
  8. conn.connect();
  9. var query ="SELECT `Customer_Id`, `Customer_Name`, `Customer_Last_Name`, `Customer_Address`, `Customer_Phone`, `Customer_Phone2`, `Customer_Email`, `Customer_Company_Name`, `Customer_Description` FROM `customers` WHERE `Customer_Deleted` = 0";
  10.  
  11. conn.query(query,function(err,result)
  12. {
  13. if(err)
  14. {
  15. console.error(err);
  16. }else{
  17. return result;
  18. }
  19. });
  20. }
  21.  
  22. router.get('/Customer_api',function(req, res){
  23.  
  24. res.send( DataRetrieval);
  25. });
  26.  
  27. $(function (){
  28. $.get('Customer_api', updateView)
  29.  
  30. function updateView(data){
  31. var output = '';
  32.  
  33. $.each(data, function(key, item){
  34. output += '<tr>';
  35. output += ' <td>Habib</td>';
  36. output += ' <td>Niger</td>';
  37. output += ' <td>Oud-Turnhout</td>';
  38. output += ' <td class="text-primary">$36,738</td>';
  39. output += '</tr>';
  40. });
  41. $('.Customers_Rows').html(output);
  42. }
  43. });
Add Comment
Please, Sign In to add comment