Question: I have a C++ app I'm developing in Linux. I'm allocating some dynamic memory and ultimately calling forkpty(). The child process is calling execl() and as we know, execl() never returns if it succeeds to execute the command. Furthermore, as we know, forkpty() makes a copy of all the parent's data. So, if the child() process never returns control back to my application in order to ultimately do memory cleanup, is it safe to say one better not have any dynamic memory allocated at the time execl() is called from the child process??? I can't believe I could not find this one on here... Thanks in advance.

Answer: 
```
jQuery.post('email.php', score, function(result) {
    jQuery('#textBlock').html(result);
});

```

Something like that should work(Result is the echo in your php in this case)

A preffered method is to encode your php result to json so you've got a little more control over it in Javascript though.

```
jQuery.post('email.php', score, function(result) {
    if (result.result == true) {
        jQuery('#textBlock').html(result.text);
    }
});

```

And in the email.php:

```
$result['result'] = true;
$result['text'] = 'Message has been sent';

header('Content-Type: application/json');
echo json_encode($result);

```
Here see if this works:

```
<form name="contact" action="**submit to same page**" id="contact_form">

<input type="submit" name="submit" id="submit_btn" value="Send" /> 

</form>

```

Then for the php (on the same page as the email form) just add if submit

```
<?php
if(isset($_POST['submit'])){

 run your email script, add javascript, etc.
echo "Your email was sent!"; // success message
}

  }
    ?>

```