Jump to content
<form id="submit" method="post" action="#">
<button id="callFunc" type="button">Click Me</button>
  
  
  echo "<table border='1'>";
		echo "<tbody>";

	foreach($dbr as $record) {
	echo "<table border='1' style='position:relative; float:left;'>";
		echo "<tbody>";
		echo "<tr>";
		echo "<td class='autocomplete' style='width:300px; background-color:#ddd;'>
		Fournisseur:<div><input id='nom' type='text' placeholder='" . $record['Id'] . "'name='id' /></div> 
		Nom: <div><input id='Usager' type='text' placeholder='" . $record['IdBon'] . "'name='idBon' /></div>
		Numéro bon de livraison: <div><input id='NumeroBonLivraison' type='text' placeholder='" . $record['Num'] . "'name='Num' /></div> 
		
		</td>";
		echo "</tr>";
		echo "<tr>";
		echo "</tr>";
		echo "</tbody>";
		echo "</table>";	
	}
}

 

function modLivre() {



 $args = array($id, $IdBon, $Num,);        

    $result = $MDO->query('EXEC ModLivre  ?, ?, ?, $args);
<script type="text/javascript">
    $(document).ready(function(){
        $("#call").click(function(){
            $.ajax({

        url: 'db.php',
        type: 'POST',
        data: { Id : 'id', IdBon : 'idBon', Num : 'num', 
         
        },
        success: function(modLivre) {         
			alert('qwdqw');		
        }               
    });
   });
});
</script>

I need help on the ajax part how do you pass the $_POST value in the ajax so the modLivre function get the parameters?

Link to comment
https://linustechtips.com/topic/932770-call-php-function-with-ajax/
Share on other sites

Link to post
Share on other sites

https://stackoverflow.com/questions/8599595/send-json-data-from-javascript-to-php

 

Since you're using jQuery check the second answer. You will need to turn your "data" object into a JSON string first but that should do what you want.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×