I am starting to learn about classes in php and was wondering how I would be able to call a function that is within a class, but using it in the url field for ajax.
Basically, I have:
$(document).ready(function(){
$('#submit').click(function(e) {
$.ajax({
type : 'POST',
url : 'addCustomer.php',
dataType : 'json',
data:{
lastName : $('#add_LN').val(),
firstName : $('#add_FN').val(),
phone : $('#add_PN').val(),
dob : $('#add_DOB').val()
},
What my addCustomer.php does is create an instance of my class "customer_module" and then calls functions within customer_module.
But I would like to get rid of addCustomer.php all together, and just call the function in customer_module.php. This functions name will be addCustomer($last_name, $first_name, $phone, $dob).
customer_module.php
class customer_module
{
public function addCustomer($last_name, $first_name, $phone, $dob)
{
...
}
}
What should I change my ajax function to look like?