Hello guys i wrote an public function to create a project, but i need to call it in my javascript file. How can i do this.
this is the public function i want to use. the public funtion is in data.php
public function create($projectid,$projectnaam,$startdatum,$einddatum,$omschrijving)
{
try
{
$stmt = $this->db->prepare("INSERT INTO projects (projectid, projectnaam, startdatum, einddatum, omschrijving) VALUES (".$projectid.",'".$projectnaam."', '".$startdatum."', '".$einddatum."', '".$omschrijving."')";
$stmt->bindparam(":projectid",$projectid);
$stmt->bindparam(":projectnaam",$projectnaam);
$stmt->bindparam(":startdatum",$startdatum);
$stmt->bindparam(":einddatum",$einddatum);
$stmt->bindparam(":einddatum",$omschrijving);
$stmt->execute();
return true;
}
catch(PDOException $e)
{
echo $e->getMessage();
return false;
}
}
and this is where i need to call the function, but how? I tryd it like this, but it doesnt work. this is in a javascript file
url: 'data.php?update',