I have a custom form coded in a page template, data is being sent properly.
Part of the code is this
$.ajax({
type: "POST",
url: "<?php bloginfo("template_directory"); ?>/saveme.php",
data: $(form).serialize(),
timeout: 3000,
success: function() { alert('Success');},
error: function() {alert('Some errors occured, please try again.');}
And in saveme.php file which is inside my theme folder, I kept this code with some static data to check if it saves or not.
<?php
global $wpdb;
$wpdb->insert( 'mycontact', array( 'name' => 'testname', 'lastname' => 'testlastname', 'email' => 'test@test.com', 'phone' => '343434343'));
?>
The data does not save, I don't think i am doing it the right way, any help?