-5

Basically, after I check in jQuery.post that it's a success, I need to equate the PHP variables I created inside the success part to the response

Example:

function(response.success) {
<?php 
global $wpdb;

$table = 'wp_special';
$name = RESPONSE NAME FROM PHP FILE
$email= RESPONSE EMAIL FROM PHP FILE

$wpdb->insert(
    $table,
    array(
        'id' => '',
        'name' => $name,
        'email' => $email,
    )
);
?>
}

If that won't work, is there a way to insert in the database in my process.php file?. Somehow, WordPress won't let me.

Padmanathan J
  • 4,614
  • 5
  • 37
  • 75
user2772219
  • 129
  • 1
  • 10
  • 1
    If you want to do something at server side on success response then call AJAX on success response again, Or do it in your `jQuery.post` – Jahanzeb Jan 24 '14 at 08:00

1 Answers1

0

First of all, the php code is processed on server-side, that means once you run this page the php code won't run again calling a javascript function like that, thats only achievable if you use AJAX.

If you have access to the php script that you first post to, continue the php process there. If you can't alter that script, create another php script which you will post to it after you get the data needed from response.

G.Mendes
  • 1,201
  • 1
  • 13
  • 18